ui: Reduce async upload context switching overhead by using atomics instead of posting reply tasks.
ui: Reduce async upload context switching overhead by using atomics instead of posting reply tasks.

This significantly reduces the context switching overhead for async
texture uploads on android.

The upload thread is often descheduled after each upload when using
a reply message to notify main thread of completion. This is
especially bad when upload thread has lower priority than the main
gpu thread as the upload thread is then consistently descheduled.

By using atomics to determine when uploads complete we avoid these
unnecessary context switches and get better async upload efficiency.

BUG=173802


Review URL: https://chromiumcodereview.appspot.com/12207100

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@183624 0039d316-1c4b-4281-b951-d872f2087c98

Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Jonekee/chromium.src,ltilve/chromium,markYoungH/chromium.src,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,zcbenz/cefode-chromium,littlstar/chromium.src,hujiajie/pa-chromium,anirudhSK/chromium,dednal/chromium.src,chuan9/chromium-crosswalk,Chilledheart/chromium,anirudhSK/chromium,dushu1203/chromium.src,M4sse/chromium.src,hujiajie/pa-chromium,pozdnyakov/chromium-crosswalk,Fireblend/chromium-crosswalk,ondra-novak/chromium.src,markYoungH/chromium.src,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,dednal/chromium.src,anirudhSK/chromium,hujiajie/pa-chromium,chuan9/chromium-crosswalk,ltilve/chromium,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,mogoweb/chromium-crosswalk,Just-D/chromium-1,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,littlstar/chromium.src,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,patrickm/chromium.src,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,krieger-od/nwjs_chromium.src,jaruba/chromium.src,mogoweb/chromium-crosswalk,Just-D/chromium-1,M4sse/chromium.src,axinging/chromium-crosswalk,anirudhSK/chromium,chuan9/chromium-crosswalk,anirudhSK/chromium,zcbenz/cefode-chromium,littlstar/chromium.src,ChromiumWebApps/chromium,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,anirudhSK/chromium,chuan9/chromium-crosswalk,axinging/chromium-crosswalk,patrickm/chromium.src,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,Chilledheart/chromium,M4sse/chromium.src,hujiajie/pa-chromium,PeterWangIntel/chromium-crosswalk,bright-sparks/chromium-spacewalk,ondra-novak/chromium.src,anirudhSK/chromium,dednal/chromium.src,Jonekee/chromium.src,ltilve/chromium,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,ondra-novak/chromium.src,Jonekee/chromium.src,ltilve/chromium,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,TheTypoMaster/chromium-crosswalk,markYoungH/chromium.src,patrickm/chromium.src,mogoweb/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,M4sse/chromium.src,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,hujiajie/pa-chromium,mogoweb/chromium-crosswalk,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,Fireblend/chromium-crosswalk,anirudhSK/chromium,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,timopulkkinen/BubbleFish,Jonekee/chromium.src,zcbenz/cefode-chromium,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Chilledheart/chromium,krieger-od/nwjs_chromium.src,jaruba/chromium.src,zcbenz/cefode-chromium,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,Just-D/chromium-1,jaruba/chromium.src,hgl888/chromium-crosswalk,jaruba/chromium.src,patrickm/chromium.src,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,dednal/chromium.src,littlstar/chromium.src,littlstar/chromium.src,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,hujiajie/pa-chromium,fujunwei/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,dushu1203/chromium.src,hujiajie/pa-chromium,axinging/chromium-crosswalk,jaruba/chromium.src,hujiajie/pa-chromium,jaruba/chromium.src,timopulkkinen/BubbleFish,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,jaruba/chromium.src,ondra-novak/chromium.src,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,zcbenz/cefode-chromium,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,fujunwei/chromium-crosswalk,littlstar/chromium.src,jaruba/chromium.src,axinging/chromium-crosswalk,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,patrickm/chromium.src,zcbenz/cefode-chromium,Just-D/chromium-1,anirudhSK/chromium,Pluto-tv/chromium-crosswalk,dednal/chromium.src,mogoweb/chromium-crosswalk,jaruba/chromium.src,axinging/chromium-crosswalk,dednal/chromium.src,markYoungH/chromium.src,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,patrickm/chromium.src,markYoungH/chromium.src,hujiajie/pa-chromium,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,anirudhSK/chromium,hgl888/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Chilledheart/chromium,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,hgl888/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,Chilledheart/chromium,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,fujunwei/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,patrickm/chromium.src,Fireblend/chromium-crosswalk,Pluto-tv/chromium-crosswalk,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,zcbenz/cefode-chromium,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,hujiajie/pa-chromium,ltilve/chromium,Fireblend/chromium-crosswalk,markYoungH/chromium.src,ChromiumWebApps/chromium,Chilledheart/chromium,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,axinging/chromium-crosswalk,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,mogoweb/chromium-crosswalk,Chilledheart/chromium,Just-D/chromium-1,patrickm/chromium.src,patrickm/chromium.src,dushu1203/chromium.src,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,Jonekee/chromium.src,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,Jonekee/chromium.src,mogoweb/chromium-crosswalk,anirudhSK/chromium,mogoweb/chromium-crosswalk,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,ondra-novak/chromium.src,ChromiumWebApps/chromium,Just-D/chromium-1,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,timopulkkinen/BubbleFish,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,zcbenz/cefode-chromium,bright-sparks/chromium-spacewalk,jaruba/chromium.src,mogoweb/chromium-crosswalk,markYoungH/chromium.src,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,timopulkkinen/BubbleFish,fujunwei/chromium-crosswalk,Fireblend/chromium-crosswalk,Just-D/chromium-1,hgl888/chromium-crosswalk-efl,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,Just-D/chromium-1,ltilve/chromium,M4sse/chromium.src,zcbenz/cefode-chromium,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacewalk,littlstar/chromium.src,zcbenz/cefode-chromium,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,anirudhSK/chromium,timopulkkinen/BubbleFish,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,Chilledheart/chromium,TheTypoMaster/chromium-crosswalk,dednal/chromium.src