| 
    
      
  | 
  
 Chromium Code Reviews
        
  DescriptionAndroid: Switch to thread pool executor.
Switches BackgroundSyncLauncher to the thread pool executor and add
comments explaining why AsyncTask is necessary.
BUG=601053
Committed: https://crrev.com/ad3ee42510afda09e00cb73c694bfa4626980d1d
Cr-Commit-Position: refs/heads/master@{#438573}
   
  Patch Set 1 #Patch Set 2 : Remove asynctasks. #Patch Set 3 : Switch to thread pool and minor fixes. #
      Total comments: 2
      
     
  
  Patch Set 4 : Fix test. #Patch Set 5 : Fix tests. #
      Total comments: 2
      
     
  
  Patch Set 6 : Fix comments. #Patch Set 7 : Fix tests relying on serial executor. #
 Messages
    Total messages: 48 (31 generated)
     
  
  
 Description was changed from ========== Android: Switch to thread pool executor Switches BackgroundSyncLauncher to use AsyncTask.THREAD_POOL_EXECUTOR. BUG=601053 ========== to ========== Android: Remove AsyncTask from sync launcher Switches BackgroundSyncLauncher to edit preferences directly. Since Preferences#apply is used there is no performance impact. BUG=601053 ========== 
 wnwen@chromium.org changed reviewers: + iclelland@chromium.org 
 Hi Ian, I don't think the two AsyncTasks are necessary. It's only .commit that write to disk, .apply makes the edits in memory and schedules a task to commit to disk. Thanks, Peter 
 Friendly ping. 
 On 2016/12/13 16:35:15, Peter Wen wrote: > Friendly ping. Sorry for the delay. I'm not certain what you mean when you say you "don't think the two AsyncTaks are necessary". This CL doesn't actually remove them, just puts them into the parallel thread pool, if I understand it. There don't seem to be any possible races here (they're run at very different times) so I don't see a problem with the change; it just doesn't match the comment or the CL description, I think. If you mean that we could get rid of the AsyncTask entirely, and just call apply directly -- it was added here: https://codereview.chromium.org/1288593003 because, apparently, writing them directly violated strict mode. Is that no longer an issue? 
 Description was changed from ========== Android: Remove AsyncTask from sync launcher Switches BackgroundSyncLauncher to edit preferences directly. Since Preferences#apply is used there is no performance impact. BUG=601053 ========== to ========== Android: Switch to thread pool executor. Switches BackgroundSyncLauncher to the thread pool executor and add comments explaining why AsyncTask is necessary. BUG=601053 ========== 
 On 2016/12/13 16:54:29, iclelland wrote: > On 2016/12/13 16:35:15, Peter Wen wrote: > > Friendly ping. > > Sorry for the delay. I'm not certain what you mean when you say you "don't think > the two AsyncTaks are necessary". This CL doesn't actually remove them, just > puts them into the parallel thread pool, if I understand it. > > There don't seem to be any possible races here (they're run at very different > times) so I don't see a problem with the change; it just doesn't match the > comment or the CL description, I think. > > If you mean that we could get rid of the AsyncTask entirely, and just call apply > directly -- it was added here: https://codereview.chromium.org/1288593003 > because, apparently, writing them directly violated strict mode. Is that no > longer an issue? Sorry for the mix-up, forgot to upload patch 2. Based on that bug I missed the fact that this would be run without a browser process, so I doubt ContextUtils.getAppSharedPreferences will have been cached earlier, which means that these accesses will trigger disk read on the first fetch, so AsyncTask is appropriate here due to it being on the UI thread. Thanks for checking possible races, PTAL. 
 The CQ bit was checked by wnwen@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 https://codereview.chromium.org/2562643004/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java (right): https://codereview.chromium.org/2562643004/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java:29: * {@link AsyncTask} is necessary as the browser process will not have warmed up the Should this comment be on the methods that use AsyncTask? Or is the point to justify the usage within this class? 
 On 2016/12/13 17:56:33, Peter Wen wrote: > On 2016/12/13 16:54:29, iclelland wrote: > > On 2016/12/13 16:35:15, Peter Wen wrote: > > > Friendly ping. > > > > Sorry for the delay. I'm not certain what you mean when you say you "don't > think > > the two AsyncTaks are necessary". This CL doesn't actually remove them, just > > puts them into the parallel thread pool, if I understand it. > > > > There don't seem to be any possible races here (they're run at very different > > times) so I don't see a problem with the change; it just doesn't match the > > comment or the CL description, I think. > > > > If you mean that we could get rid of the AsyncTask entirely, and just call > apply > > directly -- it was added here: https://codereview.chromium.org/1288593003 > > because, apparently, writing them directly violated strict mode. Is that no > > longer an issue? > > Sorry for the mix-up, forgot to upload patch 2. Based on that bug I missed the > fact that this would be run without a browser process, so I doubt > ContextUtils.getAppSharedPreferences will have been cached earlier, which means > that these accesses will trigger disk read on the first fetch, so AsyncTask is > appropriate here due to it being on the UI thread. > > Thanks for checking possible races, PTAL. Thanks, that makes sense now :) LGTM 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm6...) 
 The CQ bit was checked by wnwen@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm6...) 
 The CQ bit was checked by wnwen@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 wnwen@chromium.org changed reviewers: + mariakhomenko@chromium.org 
 Thanks Ian! +mariakhomenko@ for OWNERS. https://codereview.chromium.org/2562643004/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java (right): https://codereview.chromium.org/2562643004/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java:29: * {@link AsyncTask} is necessary as the browser process will not have warmed up the On 2016/12/13 18:26:18, iclelland wrote: > Should this comment be on the methods that use AsyncTask? Or is the point to > justify the usage within this class? I'd like to justify usage in this class as I think other methods in this class fall under the same umbrella. 
 lgtm https://codereview.chromium.org/2562643004/diff/80001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java (right): https://codereview.chromium.org/2562643004/diff/80001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java:30: * {@link SharedPreferences} before it is used here. I think you should put this comment in shouldLaunchBrowserIfStopped. This is implementation detail for that method, rather than for the class. 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 The CQ bit was checked by wnwen@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by wnwen@chromium.org 
 The CQ bit was checked by wnwen@chromium.org 
 The patchset sent to the CQ was uploaded after l-g-t-m from iclelland@chromium.org, mariakhomenko@chromium.org Link to the patchset: https://codereview.chromium.org/2562643004/#ps100001 (title: "Fix comments.") 
 Thanks for the reviews, Ian and Maria! https://codereview.chromium.org/2562643004/diff/80001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java (right): https://codereview.chromium.org/2562643004/diff/80001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java:30: * {@link SharedPreferences} before it is used here. On 2016/12/13 21:06:23, Maria wrote: > I think you should put this comment in shouldLaunchBrowserIfStopped. This is > implementation detail for that method, rather than for the class. Done. 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...) 
 The CQ bit was checked by wnwen@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 The CQ bit was checked by wnwen@chromium.org 
 The patchset sent to the CQ was uploaded after l-g-t-m from iclelland@chromium.org, mariakhomenko@chromium.org Link to the patchset: https://codereview.chromium.org/2562643004/#ps120001 (title: "Fix tests relying on serial executor.") 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 CQ is committing da patch.
Bot data: {"patchset_id": 120001, "attempt_start_ts": 1481741819126620,
"parent_rev": "7c494023b2caa9a7aff33d9bb5b456a49c85fe21", "commit_rev":
"e7da7097d84f3b7ae9c4bfaccd193c283f01c8fa"}
          
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Android: Switch to thread pool executor. Switches BackgroundSyncLauncher to the thread pool executor and add comments explaining why AsyncTask is necessary. BUG=601053 ========== to ========== Android: Switch to thread pool executor. Switches BackgroundSyncLauncher to the thread pool executor and add comments explaining why AsyncTask is necessary. BUG=601053 Review-Url: https://codereview.chromium.org/2562643004 ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Committed patchset #7 (id:120001) 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Android: Switch to thread pool executor. Switches BackgroundSyncLauncher to the thread pool executor and add comments explaining why AsyncTask is necessary. BUG=601053 Review-Url: https://codereview.chromium.org/2562643004 ========== to ========== Android: Switch to thread pool executor. Switches BackgroundSyncLauncher to the thread pool executor and add comments explaining why AsyncTask is necessary. BUG=601053 Committed: https://crrev.com/ad3ee42510afda09e00cb73c694bfa4626980d1d Cr-Commit-Position: refs/heads/master@{#438573} ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Patchset 7 (id:??) landed as https://crrev.com/ad3ee42510afda09e00cb73c694bfa4626980d1d Cr-Commit-Position: refs/heads/master@{#438573} 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        On 2016/12/14 19:14:15, commit-bot: I haz the power wrote: > Patchset 7 (id:??) landed as > https://crrev.com/ad3ee42510afda09e00cb73c694bfa4626980d1d > Cr-Commit-Position: refs/heads/master@{#438573} testNewLauncherDisablesNextOnline just failed for me on the try jobs: https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi... 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        On 2016/12/14 21:37:52, Ted C wrote: > On 2016/12/14 19:14:15, commit-bot: I haz the power wrote: > > Patchset 7 (id:??) landed as > > https://crrev.com/ad3ee42510afda09e00cb73c694bfa4626980d1d > > Cr-Commit-Position: refs/heads/master@{#438573} > > testNewLauncherDisablesNextOnline just failed for me on the try jobs: > > https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi... Testing it now. 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/2580503002/ by wnwen@chromium.org. The reason for reverting is: BackgroundSyncLauncherTest#testNewLauncherDisablesNextOnline fails..  | 
    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
