Fix race in gdata file system when setting on_io_completed_ event
Fix race in gdata file system when setting on_io_completed_ event

We should aquire num_pending_tasks_lock_ BEFORE we reset on_io_completed_ event.
We should do that to avoid following scenario:
* num_pending_tasks_ equals 1.

* We reset on_io_completed_ event in PostBlockingPoolSequencedTask and
ask for num_pending_tasks_lock_ to increase num_pending_tasks_

* At the same time RunTaskOnIOThreadPool finishes running its task and
asks for the same lock to decrease num_pending_tasks_

If RunTasksOnIOThreadPool gets the lock first, it will decrease
num_pending_tasks_ to 0, signal on_io_completed_ and thus undo reset
done in  PostBlockingPoolSequencedTask .

If we don't reset on_io_completed_ before GData file system begins its
destruction, we may leave task on blocking pool pending after the
gdata_file_system object is destroyed. This is dangerous since tasks on
blocking pool can alos access file system's data members.

BUG=122717
TEST=GData unit_tests

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

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

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