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

Issue 2351113005: [Reland] Refactor WebappRegistry into a singleton instance. (Closed)

Created:
4 years, 3 months ago by dominickn
Modified:
4 years, 2 months ago
Reviewers:
msramek, whywhat, Peter Wen, gone
CC:
chromium-reviews, dominickn+watch_chromium.org, markusheintz_, msramek+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Reland] Refactor WebappRegistry into a singleton instance. This CL refactors WebappRegistry and WebappDataStorage to make most of the methods synchronous. WebappRegistry is now a singleton instance that is instantiated at browser startup. This allows all SharedPreferences files to be pre-warmed before the class is used; new web apps open new SharedPreferences on a background thread when registered, after which the preferences are cached automatically. Most static methods on WebappRegistry and WebappDataStorage have been converted to instance methods or removed. This makes the code much cleaner and more efficient; each static method had to independently open their SharedPreferences, which minimally performs a stat() on the underlying XML file to see if it has changed. Now the singleton WebappRegistry caches all WebappDataStorage objects on startup and whenever new ones are added. This reduces disk IO overhead. This CL allows all calls to SharedPreferences.Editor.apply() in WebappRegistry and WebappDataStorage to occur on the main thread, mostly removing the need for unwieldy callback interfaces and bare pointer passing across the JNI. BUG=633791, 653627 Committed: https://crrev.com/beceaa5ebceead7104900401ab96fe2facc26da1 Cr-Commit-Position: refs/heads/master@{#425214}

Patch Set 1 #

Patch Set 2 : Fix some tests that weren't using WebappDataStorage correctly #

Patch Set 3 : Rebase #

Total comments: 17

Patch Set 4 : Comments, shifting initialization #

Patch Set 5 : Unnecessary throws #

Patch Set 6 : Fix WebappModeTest #

Total comments: 6

Patch Set 7 : Address nit #

Patch Set 8 : Add synchronized to stop FindBugs complaining #

Patch Set 9 : Refactor pref warming to try and placate Findbugs #

Patch Set 10 : Volatile #

Patch Set 11 : Add strict mode override in WebappActivity #

Total comments: 1

Patch Set 12 : Remove asserts which fail on Android Tests (dbg) #

Patch Set 13 : Checkstyle import order has changed overnight argh #

Patch Set 14 : More flaky tests #

Patch Set 15 : Rearrange updateSplashScreen to combat flakiness #

Total comments: 2

Patch Set 16 : Comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+665 lines, -1134 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/DeferredStartupHandler.java View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +15 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java View 2 chunks +37 lines, -41 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +16 lines, -12 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java View 1 2 3 4 5 6 7 8 2 chunks +14 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java View 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +21 lines, -37 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java View 1 2 3 4 5 6 7 8 9 10 4 chunks +31 lines, -29 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 12 chunks +106 lines, -196 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +173 lines, -221 lines 0 comments Download
M chrome/android/java_sources.gni View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java View 1 2 3 6 chunks +10 lines, -39 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 7 chunks +20 lines, -88 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +6 lines, -4 lines 0 comments Download
A chrome/android/javatests/src/org/chromium/chrome/browser/webapps/TestFetchStorageCallback.java View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +6 lines, -10 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -1 line 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +27 lines, -11 lines 0 comments Download
M chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +25 lines, -43 lines 0 comments Download
M chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 28 chunks +102 lines, -284 lines 0 comments Download
M chrome/browser/android/chrome_jni_registrar.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/android/webapps/webapp_registry.h View 2 chunks +2 lines, -9 lines 0 comments Download
M chrome/browser/android/webapps/webapp_registry.cc View 1 chunk +8 lines, -52 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +0 lines, -8 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +5 lines, -30 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -10 lines 0 comments Download

Messages

Total messages: 139 (95 generated)
dominickn
This is a follow-up from crrev.com/2352943003. +wnwen: PTAL at WebappRegistry#warmUpSharedPrefs, particularly the StrictMode policy. Is ...
4 years, 3 months ago (2016-09-21 06:58:42 UTC) #7
dominickn
On 2016/09/21 06:58:42, dominickn wrote: > This is a follow-up from crrev.com/2352943003. > > +wnwen: ...
4 years, 2 months ago (2016-09-26 23:53:08 UTC) #20
Peter Wen
https://codereview.chromium.org/2351113005/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java File chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java (right): https://codereview.chromium.org/2351113005/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java#newcode181 chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java:181: WebappRegistry.warmUpSharedPrefs(); Do you know what the access pattern for ...
4 years, 2 months ago (2016-09-27 20:57:25 UTC) #21
dominickn
Thanks! https://codereview.chromium.org/2351113005/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java File chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java (right): https://codereview.chromium.org/2351113005/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java#newcode181 chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java:181: WebappRegistry.warmUpSharedPrefs(); On 2016/09/27 20:57:25, Peter Wen wrote: > ...
4 years, 2 months ago (2016-09-28 02:06:50 UTC) #22
gone
Sweet jeebus just avoiding callback hell is worth the relatively minor (potential) StrictMode violation. https://chromiumcodereview.appspot.com/2351113005/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java ...
4 years, 2 months ago (2016-09-28 18:39:17 UTC) #23
dominickn
Thanks! Prefs warming is now split up as follows: 1. Opening a PWA. WebappRegistry + ...
4 years, 2 months ago (2016-09-29 06:55:22 UTC) #25
Peter Wen
Warming up prefs and DeferredStartupHandler lgtm. https://codereview.chromium.org/2351113005/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java File chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java (right): https://codereview.chromium.org/2351113005/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java#newcode134 chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java:134: WebappRegistry.warmUpSharedPrefs(id); To get ...
4 years, 2 months ago (2016-09-29 18:24:47 UTC) #36
gone
lgtm https://codereview.chromium.org/2351113005/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java File chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java (right): https://codereview.chromium.org/2351113005/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java#newcode81 chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java:81: // Warm up the WebappRegistry and all web ...
4 years, 2 months ago (2016-09-29 21:06:44 UTC) #37
dominickn
Thanks! +msramek: PTAL at browsing_data. https://codereview.chromium.org/2351113005/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java File chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java (right): https://codereview.chromium.org/2351113005/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java#newcode81 chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java:81: // Warm up the ...
4 years, 2 months ago (2016-09-30 00:17:01 UTC) #39
msramek
LGTM, thanks for following up on those past discussions :) (but note that you have ...
4 years, 2 months ago (2016-09-30 08:58:05 UTC) #44
dominickn
On 2016/09/30 08:58:05, msramek wrote: > LGTM, thanks for following up on those past discussions ...
4 years, 2 months ago (2016-09-30 09:38:28 UTC) #45
Peter Wen
Still lgtm % StrictMode whitelist On rare occasions DeferredStartupHandler does not get run in a ...
4 years, 2 months ago (2016-09-30 13:59:19 UTC) #56
dominickn
Thanks! Regarding DeferredStartupHandler failing, if the occasions are rare, then it should be okay. WebappRegistry ...
4 years, 2 months ago (2016-10-04 01:09:17 UTC) #59
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2351113005/200001
4 years, 2 months ago (2016-10-04 03:17:43 UTC) #62
commit-bot: I haz the power
Committed patchset #11 (id:200001)
4 years, 2 months ago (2016-10-04 04:20:14 UTC) #64
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/78cf6596040662c0a73c0e4038bc84fb2b3c470a Cr-Commit-Position: refs/heads/master@{#422703}
4 years, 2 months ago (2016-10-04 04:22:48 UTC) #66
Peng
A revert of this CL (patchset #11 id:200001) has been created in https://codereview.chromium.org/2384413003/ by penghuang@chromium.org. ...
4 years, 2 months ago (2016-10-04 12:16:15 UTC) #67
dominickn
On 2016/10/04 12:16:15, Peng wrote: > A revert of this CL (patchset #11 id:200001) has ...
4 years, 2 months ago (2016-10-04 12:30:16 UTC) #68
gone
On 2016/10/04 12:30:16, dominickn wrote: > On 2016/10/04 12:16:15, Peng wrote: > > A revert ...
4 years, 2 months ago (2016-10-04 17:14:50 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2351113005/220001
4 years, 2 months ago (2016-10-04 23:04:38 UTC) #73
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/273651)
4 years, 2 months ago (2016-10-04 23:15:18 UTC) #75
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2351113005/240001
4 years, 2 months ago (2016-10-05 04:47:20 UTC) #86
commit-bot: I haz the power
Committed patchset #13 (id:240001)
4 years, 2 months ago (2016-10-05 04:52:57 UTC) #88
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/6e08a0b7993fb106e3dea796950521cfd04a47cf Cr-Commit-Position: refs/heads/master@{#423077}
4 years, 2 months ago (2016-10-05 04:55:58 UTC) #90
Peng
A revert of this CL (patchset #13 id:240001) has been created in https://codereview.chromium.org/2390753004/ by penghuang@chromium.org. ...
4 years, 2 months ago (2016-10-05 13:19:31 UTC) #91
dvadym
A revert of this CL (patchset #13 id:240001) has been created in https://codereview.chromium.org/2397623004/ by dvadym@chromium.org. ...
4 years, 2 months ago (2016-10-05 13:55:39 UTC) #92
dominickn
dfalcantara: PTAL at WebappActivityTestBase.java (the only change). Looks like more assert tripping on KK driven ...
4 years, 2 months ago (2016-10-05 23:53:53 UTC) #94
gone
Well, third try's the charm. It's surprising this worked before.
4 years, 2 months ago (2016-10-06 00:03:38 UTC) #96
gone
(Still lgtm)
4 years, 2 months ago (2016-10-06 00:03:59 UTC) #97
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2351113005/260001
4 years, 2 months ago (2016-10-06 01:44:56 UTC) #104
commit-bot: I haz the power
Committed patchset #14 (id:260001)
4 years, 2 months ago (2016-10-06 01:52:59 UTC) #106
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/8d4f92312dc1b0cb0bfcfe8ffd981b3555bfd537 Cr-Commit-Position: refs/heads/master@{#423389}
4 years, 2 months ago (2016-10-06 01:56:39 UTC) #108
nasko
A revert of this CL (patchset #14 id:260001) has been created in https://codereview.chromium.org/2395233002/ by nasko@chromium.org. ...
4 years, 2 months ago (2016-10-06 18:29:27 UTC) #109
dominickn
And here we go again... dfalcantara: PTAL. I've redone the way that WebappDataStorage#updateSplashScreenImage works. It ...
4 years, 2 months ago (2016-10-12 08:03:46 UTC) #121
gone
Lol, indeed. LGTM, yet again. https://chromiumcodereview.appspot.com/2351113005/diff/300001/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java File chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java (right): https://chromiumcodereview.appspot.com/2351113005/diff/300001/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java#newcode165 chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java:165: * must have been ...
4 years, 2 months ago (2016-10-13 17:43:04 UTC) #122
dominickn
*Closes eyes in hope* https://codereview.chromium.org/2351113005/diff/300001/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java File chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java (right): https://codereview.chromium.org/2351113005/diff/300001/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java#newcode165 chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java:165: * must have been encoded ...
4 years, 2 months ago (2016-10-14 00:20:24 UTC) #127
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2351113005/320001
4 years, 2 months ago (2016-10-14 00:21:03 UTC) #130
commit-bot: I haz the power
Committed patchset #16 (id:320001)
4 years, 2 months ago (2016-10-14 00:28:57 UTC) #131
commit-bot: I haz the power
Patchset 16 (id:??) landed as https://crrev.com/beceaa5ebceead7104900401ab96fe2facc26da1 Cr-Commit-Position: refs/heads/master@{#425214}
4 years, 2 months ago (2016-10-14 00:31:06 UTC) #133
whywhat
https://codereview.chromium.org/2351113005/diff/200001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java File chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java (right): https://codereview.chromium.org/2351113005/diff/200001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java#newcode85 chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java:85: StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); Shouldn't this rather be added ...
4 years, 2 months ago (2016-10-19 02:37:05 UTC) #135
dominickn
This CL passed the trybots multiple times before being reverted, so we clearly have some ...
4 years, 2 months ago (2016-10-19 02:44:35 UTC) #136
whywhat
On 2016/10/19 at 02:44:35, dominickn wrote: > This CL passed the trybots multiple times before ...
4 years, 2 months ago (2016-10-19 02:55:08 UTC) #137
Peter Wen
On 2016/10/19 02:55:08, whywhat wrote: > On 2016/10/19 at 02:44:35, dominickn wrote: > > This ...
4 years, 2 months ago (2016-10-19 12:57:01 UTC) #138
Peter Wen
4 years, 2 months ago (2016-10-19 14:19:55 UTC) #139
Message was sent while issue was closed.
On 2016/10/19 12:57:01, Peter Wen wrote:
> It's true, we have a downstream N bot, but it has StrictMode disabled due to
> prior OS-wide issues that I've since fixed (should...hope so?). I'll look into
> re-enabling it. :)

http://crbug.com/657387

Powered by Google App Engine
This is Rietveld 408576698