Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Issue 1266243003: Tweaks to the precache triggering code. (Closed)

Created:
5 years, 4 months ago by twifkak
Modified:
5 years, 4 months ago
Reviewers:
bengr, Yaron, Nicolas Zea, battre
CC:
chromium-reviews, darin-cc_chromium.org, cbentzel+watch_chromium.org, jam, wifiprefetch-reviews_google.com, Miguel Garcia
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Tweaks to the precache triggering code. This commit encompasses a few related changes: 1. Enforce that IsPrecachingAllowed is called before IsPrecachingEnabled. This is so that users are only selected into the field trial if it would have an effect on them. Calling IsPrecachingEnabled triggers the field trial group selection, and doing so for users for whom !IsPrecachingAllowed means that our Enabled population consists of many users for whom precaching won't ultimately run. 2. Renamed the externally facing methods to ShouldRun and WouldRun, so I could lean on the compiler to ensure that I addressed all clients, and because PrecacheManager and PrecacheLauncher were exposing two different notions of "enabled", which I found confusing. 3. Make updatePrecachingEnabled wait, asynchronously, for the sync backend to be initialized, before determining what value to pass to setIsPrecachingEnabled. Previously, DeferredStartupHandler would call PrecacheLauncher.updatePrecachingEnabled before the sync backend was enabled, so the is_precaching_enabled pref would be set to false until either PrivacyPreferences or ConnectionChangeReceiver called updatePrecachingEnabled. This change should increase the likelihood that precaching will run when the conditions are right, and decrease the time until that happens. 4. Get rid of the redundant PrivacyPreferencesManager parameter, to simplify the interface and thus make the implementation more flexible. 5. Change from android.util.Log to org.chromium.base.Log, per presubmit warning. BUG=309216 Committed: https://crrev.com/b2175430067b9063923edab0ac3ae1b986d11d39 Cr-Commit-Position: refs/heads/master@{#342427}

Patch Set 1 #

Patch Set 2 : Call OnPrecacheCompleted from early return. #

Total comments: 2

Patch Set 3 : Add @VisibleForTesting to runOnUiThreadBlockingNoException(Callable). #

Total comments: 11

Patch Set 4 : Add @Override to anonymous inner Runnable. #

Total comments: 6

Patch Set 5 : PrecacheLauncherTest tweaks. #

Total comments: 6

Patch Set 6 : Rebase. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+345 lines, -64 lines) Patch
M base/android/java/src/org/chromium/base/ThreadUtils.java View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/DeferredStartupHandler.java View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java View 1 2 3 3 chunks +71 lines, -19 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java View 5 chunks +9 lines, -3 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/preferences/ConnectionChangeReceiver.java View 2 chunks +1 line, -4 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java View 1 2 3 4 5 1 chunk +2 lines, -4 lines 0 comments Download
A chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java View 1 2 3 4 1 chunk +191 lines, -0 lines 0 comments Download
M chrome/browser/android/precache/precache_launcher.cc View 1 2 chunks +7 lines, -6 lines 0 comments Download
M chrome/browser/net/chrome_network_delegate.cc View 2 chunks +5 lines, -6 lines 0 comments Download
M components/precache/content/precache_manager.h View 2 chunks +16 lines, -5 lines 2 comments Download
M components/precache/content/precache_manager.cc View 3 chunks +29 lines, -12 lines 2 comments Download
M components/precache/content/precache_manager_unittest.cc View 2 chunks +10 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 33 (8 generated)
twifkak
battre@chromium.org: Please review changes in chrome/browser/net. bengr@chromium.org: Please review changes in *precache*. (Your approval is ...
5 years, 4 months ago (2015-08-01 05:20:05 UTC) #2
twifkak
+zea: This change affects a client of the sync service, so you might be interested ...
5 years, 4 months ago (2015-08-01 05:44:37 UTC) #4
battre
chrome/browser/net LGTM
5 years, 4 months ago (2015-08-03 09:43:42 UTC) #5
Nicolas Zea
sync usage LGTM
5 years, 4 months ago (2015-08-03 18:14:07 UTC) #6
twifkak
miguelg + bengr: I made a tweak to PrecacheLauncher::Start to call OnPrecacheComplete on early return ...
5 years, 4 months ago (2015-08-03 22:27:33 UTC) #7
twifkak
-miguelg, +yfriedman for chrome/android and chrome/browser/android. Originally, I just picked the person with the highest ...
5 years, 4 months ago (2015-08-04 03:54:29 UTC) #9
twifkak
Also, any clues on the linux_android_rel_ng error? This seems completely unrelated to my change, but ...
5 years, 4 months ago (2015-08-04 05:17:43 UTC) #10
twifkak
On 2015/08/04 05:17:43, twifkak wrote: > < public static void setWillOverrideUiThread(); > < public static ...
5 years, 4 months ago (2015-08-04 05:20:49 UTC) #11
Yaron
https://codereview.chromium.org/1266243003/diff/20001/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java File chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java (right): https://codereview.chromium.org/1266243003/diff/20001/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java#newcode79 chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java:79: ThreadUtils.runOnUiThreadBlocking(new Runnable() { I think you need to add ...
5 years, 4 months ago (2015-08-04 21:07:13 UTC) #12
twifkak
https://codereview.chromium.org/1266243003/diff/20001/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java File chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java (right): https://codereview.chromium.org/1266243003/diff/20001/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java#newcode79 chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheLauncherTest.java:79: ThreadUtils.runOnUiThreadBlocking(new Runnable() { On 2015/08/04 21:07:13, Yaron wrote: > ...
5 years, 4 months ago (2015-08-04 23:17:15 UTC) #13
Yaron
https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java File chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java (right): https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java#newcode62 chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java:62: * Updates the PrecacheServiceLauncher with whether conditions are right ...
5 years, 4 months ago (2015-08-05 15:57:04 UTC) #14
twifkak
https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java File chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java (right): https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java#newcode62 chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java:62: * Updates the PrecacheServiceLauncher with whether conditions are right ...
5 years, 4 months ago (2015-08-05 17:44:23 UTC) #15
Yaron
lgtm with a possible suggestion for improvement https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java File chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java (right): https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java#newcode62 chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java:62: * Updates ...
5 years, 4 months ago (2015-08-05 21:43:47 UTC) #16
twifkak
https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java File chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java (right): https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java#newcode131 chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java:131: private static final PrecacheLauncher sInstance = new PrecacheLauncher() { ...
5 years, 4 months ago (2015-08-05 22:31:30 UTC) #17
bengr
https://codereview.chromium.org/1266243003/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java File chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java (right): https://codereview.chromium.org/1266243003/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java#newcode33 chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java:33: private static final String TAG = "cr.Precache"; Why are ...
5 years, 4 months ago (2015-08-06 00:01:01 UTC) #18
twifkak
https://codereview.chromium.org/1266243003/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java File chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java (right): https://codereview.chromium.org/1266243003/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java#newcode33 chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java:33: private static final String TAG = "cr.Precache"; On 2015/08/06 ...
5 years, 4 months ago (2015-08-06 00:18:17 UTC) #19
Yaron
On 2015/08/05 22:31:30, twifkak wrote: > https://codereview.chromium.org/1266243003/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java > File > chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java > (right): > > ...
5 years, 4 months ago (2015-08-06 15:17:36 UTC) #20
bengr
components/precache lgtm with nits. https://codereview.chromium.org/1266243003/diff/100001/components/precache/content/precache_manager.cc File components/precache/content/precache_manager.cc (right): https://codereview.chromium.org/1266243003/diff/100001/components/precache/content/precache_manager.cc#newcode103 components/precache/content/precache_manager.cc:103: if (ShouldRun()) { Maybe do: ...
5 years, 4 months ago (2015-08-07 17:21:46 UTC) #21
twifkak
Thanks for the lg. https://codereview.chromium.org/1266243003/diff/100001/components/precache/content/precache_manager.cc File components/precache/content/precache_manager.cc (right): https://codereview.chromium.org/1266243003/diff/100001/components/precache/content/precache_manager.cc#newcode103 components/precache/content/precache_manager.cc:103: if (ShouldRun()) { On 2015/08/07 ...
5 years, 4 months ago (2015-08-07 17:57:08 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1266243003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1266243003/100001
5 years, 4 months ago (2015-08-07 17:58:49 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/96605)
5 years, 4 months ago (2015-08-07 19:18:10 UTC) #28
twifkak
On 2015/08/07 19:18:10, commit-bot: I haz the power wrote: > Try jobs failed on following ...
5 years, 4 months ago (2015-08-07 19:19:15 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1266243003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1266243003/100001
5 years, 4 months ago (2015-08-07 19:20:10 UTC) #31
commit-bot: I haz the power
Committed patchset #6 (id:100001)
5 years, 4 months ago (2015-08-07 20:19:14 UTC) #32
commit-bot: I haz the power
5 years, 4 months ago (2015-08-07 20:19:54 UTC) #33
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/b2175430067b9063923edab0ac3ae1b986d11d39
Cr-Commit-Position: refs/heads/master@{#342427}

Powered by Google App Engine
This is Rietveld 408576698