DescriptionTweaks 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
Dependent Patchsets: Messages
Total messages: 33 (8 generated)
|