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

Issue 2160513002: Extract AppBannerDataFetcher into an InstallableManager. (Closed)

Created:
4 years, 5 months ago by dominickn
Modified:
4 years, 4 months ago
Reviewers:
Lei Zhang, benwells, gone
CC:
chromium-reviews, Matt Giuca, pkotwicz, Xi Han, mlamouri (slow - plz ping)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Extract AppBannerDataFetcher into an InstallableManager. Checking that a webapp is installable requires several asynchronous calls to verify a number of installable criteria, including: - the existence of a web app manifest and its validity - the existence of a service worker - the existence and fetchability of an appropriate icon Currently, AppBannerDataFetcher performs the fetching and checking of these resources for displaying app banners. However, new features, such as WebAPKs, and existing features, such as add to homescreen, cannot easily reuse the app banner code, leading to duplicated code and browser->renderer IPCs to repeatedly fetch manifests and icons. Additionally, the app banner code is complicated by the need to support native app banners on mobile, which require a manifest but no service worker or manifest icon. App banners have 3 manager classes and 3 fetcher classes, containing generic, desktop-specific, and Android-specific functionality respectively. This CL introduces an InstallableManager which is a WebContents-scoped version of AppBannerDataFetcher. It allows the installable criteria to be fetched and cached per WebContents. Multiple clients can request the same data from the InstallableManager, but each resource will only be retrieved once before being cached on the object in the browser process. This will reduce the code duplication required for checking installability. It will also ensure that multiple requests for the same data do not cause additional, extraneous IPCs and network requests. Future CLs will: - replace AppBannerDataFetchers with InstallableManager, and consolidate platform-dependent app banner features (https://crrev.com/2156113002) - replace manifest/icon fetching in add to homescreen code with a call to the InstallableManager - introduce new UMA metrics for banners using the new InstallableErrorCode enum (https://crrev.com/2178833002) - improve app banner testing by mocking out the InstallableManager (i.e. separating testing of resource fetching from testing of banner triggering conditions). BUG=628921 Committed: https://crrev.com/54ca9f2b3d1220955427267319895a8e077c2254 Cr-Commit-Position: refs/heads/master@{#409478}

Patch Set 1 #

Patch Set 2 : Add explicit default constructor for InstallableParams #

Patch Set 3 : Uninitialized pointer #

Patch Set 4 : Fix uint32_t coerce to bool #

Patch Set 5 : Better DCHECKs #

Patch Set 6 : Use pending_tasks_ vector and invoke callbacks directly #

Total comments: 17

Patch Set 7 : Addressing reviewer comments #

Total comments: 11

Patch Set 8 : NO_ERROR is a macro on Windows >.< #

Patch Set 9 : Extract refcounted InstallableDataFetcher #

Patch Set 10 : Revert to a non-refcounted implementation #

Total comments: 31

Patch Set 11 : Addressing comments #

Patch Set 12 : Remove RunCallbacks loop, remove pending_tasks_, clean up #

Patch Set 13 : Remove running_callback_, add nested test #

Patch Set 14 : s/checker/manager; collapse valid manifest + SW into one #

Total comments: 34

Patch Set 15 : Addressing comments #

Total comments: 4

Patch Set 16 : Addressing nits #

Total comments: 11

Patch Set 17 : Addressing comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1512 lines, -30 lines) Patch
A + chrome/browser/installable/OWNERS View 1 chunk +0 lines, -1 line 0 comments Download
A chrome/browser/installable/installable_logging.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +50 lines, -0 lines 0 comments Download
A chrome/browser/installable/installable_logging.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +142 lines, -0 lines 0 comments Download
A chrome/browser/installable/installable_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +191 lines, -0 lines 0 comments Download
A chrome/browser/installable/installable_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +444 lines, -0 lines 0 comments Download
A chrome/browser/installable/installable_manager_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +609 lines, -0 lines 0 comments Download
A + chrome/browser/installable/installable_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +65 lines, -24 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi 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/chrome_tests_unit.gypi 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
A + chrome/test/data/banners/manifest_no_service_worker.html View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/test/data/banners/play_app_test_page.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -3 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 104 (75 generated)
dominickn
PTAL, thanks! (Also I'm sorry) This is the first of two very large patches which ...
4 years, 5 months ago (2016-07-18 12:44:53 UTC) #21
dominickn
@dfalcantara: let me know if you'd also like to be an OWNER of installable/
4 years, 5 months ago (2016-07-18 14:21:39 UTC) #26
gone
Haven't gone through the test yet, but I figure I should send out this bit ...
4 years, 5 months ago (2016-07-20 22:21:35 UTC) #29
gone
Overall looks a lot better than before. The test does seem like it's checking some ...
4 years, 5 months ago (2016-07-20 22:51:52 UTC) #30
dominickn
Thanks! Regarding the test, it's a bit painful, but I think it's pretty important to ...
4 years, 5 months ago (2016-07-21 00:24:47 UTC) #32
gone
lgtm, thanks! https://chromiumcodereview.appspot.com/2160513002/diff/100001/chrome/browser/installable/installable_checker.cc File chrome/browser/installable/installable_checker.cc (right): https://chromiumcodereview.appspot.com/2160513002/diff/100001/chrome/browser/installable/installable_checker.cc#newcode27 chrome/browser/installable/installable_checker.cc:27: const int kIconMinimumSizeInPx = 144; On 2016/07/21 ...
4 years, 5 months ago (2016-07-21 00:49:27 UTC) #36
benwells
Initial comments, mainly on comments :) I want to talk to you about the structure ...
4 years, 5 months ago (2016-07-21 06:52:47 UTC) #41
dominickn
dfalcantara, benwells - please take another look. This has shifted right around now based on ...
4 years, 5 months ago (2016-07-21 09:13:38 UTC) #44
gone
Still LGTM on my end.
4 years, 5 months ago (2016-07-21 19:54:57 UTC) #48
gone
Er, any reason why you keep flipping back and forth?
4 years, 5 months ago (2016-07-22 17:29:32 UTC) #49
dominickn
On 2016/07/22 17:29:32, dfalcantara wrote: > Er, any reason why you keep flipping back and ...
4 years, 4 months ago (2016-07-24 23:44:44 UTC) #50
benwells
On 2016/07/24 23:44:44, dominickn wrote: > On 2016/07/22 17:29:32, dfalcantara wrote: > > Er, any ...
4 years, 4 months ago (2016-07-26 03:01:23 UTC) #51
benwells
Sorry I'm so slow with this. This is a first round, as I'm sheriffing I'll ...
4 years, 4 months ago (2016-07-26 03:28:46 UTC) #52
benwells
next bunch of stuff https://codereview.chromium.org/2160513002/diff/190001/chrome/browser/installable/installable_checker.cc File chrome/browser/installable/installable_checker.cc (right): https://codereview.chromium.org/2160513002/diff/190001/chrome/browser/installable/installable_checker.cc#newcode135 chrome/browser/installable/installable_checker.cc:135: // Clear the STARTED flag ...
4 years, 4 months ago (2016-07-26 07:27:14 UTC) #53
dominickn
PTAL - #ps11 is an intermediate step, while #ps12 is a bigger change that removes ...
4 years, 4 months ago (2016-07-28 00:36:28 UTC) #62
dominickn
Update: ps13 removes running_callback_ since changes to how is_active_ is used make it unnecessary. :)
4 years, 4 months ago (2016-07-28 03:06:47 UTC) #65
benwells
This is getting a lot nicer! I'm still wondering why we need to have the ...
4 years, 4 months ago (2016-07-28 08:10:58 UTC) #68
dominickn
PTAL, thanks. Checker is now manager. I still think it's important for consistency to have ...
4 years, 4 months ago (2016-07-29 02:08:50 UTC) #71
benwells
Looking great and getting really close... https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.cc File chrome/browser/installable/installable_manager.cc (right): https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.cc#newcode166 chrome/browser/installable/installable_manager.cc:166: if (!web_contents || ...
4 years, 4 months ago (2016-07-29 04:36:55 UTC) #74
benwells
Looking great and getting really close... https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.cc File chrome/browser/installable/installable_manager.cc (right): https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.cc#newcode166 chrome/browser/installable/installable_manager.cc:166: if (!web_contents || ...
4 years, 4 months ago (2016-07-29 04:36:55 UTC) #75
dominickn
PTAL, thanks. https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.cc File chrome/browser/installable/installable_manager.cc (right): https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.cc#newcode166 chrome/browser/installable/installable_manager.cc:166: if (!web_contents || !is_active_) On 2016/07/29 04:36:54, ...
4 years, 4 months ago (2016-07-31 23:32:05 UTC) #80
dominickn
benwells: ping
4 years, 4 months ago (2016-08-03 00:35:18 UTC) #82
benwells
lgtm with some nits. thanks Dom! https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.h File chrome/browser/installable/installable_manager.h (right): https://codereview.chromium.org/2160513002/diff/260001/chrome/browser/installable/installable_manager.h#newcode94 chrome/browser/installable/installable_manager.h:94: // will not ...
4 years, 4 months ago (2016-08-03 01:17:28 UTC) #83
dominickn
Thanks! dfalcantara: any further comments? +thestig for chrome/browser OWNERs. This adds a new directory to ...
4 years, 4 months ago (2016-08-03 06:38:05 UTC) #91
Lei Zhang
lgtm https://codereview.chromium.org/2160513002/diff/300001/chrome/browser/installable/installable_logging.cc File chrome/browser/installable/installable_logging.cc (right): https://codereview.chromium.org/2160513002/diff/300001/chrome/browser/installable/installable_logging.cc#newcode14 chrome/browser/installable/installable_logging.cc:14: static const std::string& GetMessagePrefix() { no need for ...
4 years, 4 months ago (2016-08-03 06:49:52 UTC) #92
dominickn
Thanks! https://codereview.chromium.org/2160513002/diff/300001/chrome/browser/installable/installable_logging.cc File chrome/browser/installable/installable_logging.cc (right): https://codereview.chromium.org/2160513002/diff/300001/chrome/browser/installable/installable_logging.cc#newcode14 chrome/browser/installable/installable_logging.cc:14: static const std::string& GetMessagePrefix() { On 2016/08/03 06:49:51, ...
4 years, 4 months ago (2016-08-03 07:01:43 UTC) #95
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/2160513002/320001
4 years, 4 months ago (2016-08-03 08:45:22 UTC) #100
commit-bot: I haz the power
Committed patchset #17 (id:320001)
4 years, 4 months ago (2016-08-03 08:49:10 UTC) #102
commit-bot: I haz the power
4 years, 4 months ago (2016-08-03 08:52:33 UTC) #104
Message was sent while issue was closed.
Patchset 17 (id:??) landed as
https://crrev.com/54ca9f2b3d1220955427267319895a8e077c2254
Cr-Commit-Position: refs/heads/master@{#409478}

Powered by Google App Engine
This is Rietveld 408576698