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

Issue 2916533002: Introduce chrome://flags/#network-prediction-options-for-service-worker

Created:
3 years, 6 months ago by horo
Modified:
3 years, 5 months ago
Reviewers:
falken, kinuko
CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, cbentzel+watch_chromium.org, shimazu+serviceworker_chromium.org, serviceworker-reviews, jam, kinuko+serviceworker, nhiroki, net-reviews_chromium.org, darin-cc_chromium.org, asvitkine+watch_chromium.org, horo+watch_chromium.org, kinuko+watch, tzik, blink-worker-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce chrome://flags/#network-prediction-options-for-service-worker This CL introduces the following network predictor options for service worker controlled pages. - PreconnectOnly (default): Execute the preconnection on navigations. - StartServiceWorkerAndPreconnect: Start the service worker and execute the preconnection in parallel on navigations. - StartServiceWorkerAndDeferPreconnect: Start the service worker on navigations, and defer the preconnection until the service worker startup. - StartServiceWorkerOnly: Start the service worker on navigations and do not execute the preconnection. BUG=727544

Patch Set 1 #

Total comments: 2

Patch Set 2 : Not to trigger PreconnectUrlWithPredictor when AND_PRECONNECT and lookup fails #

Total comments: 12

Patch Set 3 : wip #

Patch Set 4 : incorporated falken's comment #

Patch Set 5 : use StartServiceWorkerForNavigationHint #

Unified diffs Side-by-side diffs Delta from patch set Stats (+502 lines, -6 lines) Patch
M chrome/browser/about_flags.cc View 1 2 3 4 3 chunks +24 lines, -0 lines 0 comments Download
M chrome/browser/chrome_service_worker_browsertest.cc View 1 2 3 4 4 chunks +296 lines, -0 lines 0 comments Download
M chrome/browser/flag_descriptions.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/flag_descriptions.cc View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/net/prediction_options.h View 2 chunks +15 lines, -0 lines 0 comments Download
M chrome/browser/net/prediction_options.cc View 3 chunks +36 lines, -0 lines 0 comments Download
M chrome/browser/net/predictor_tab_helper.h View 1 2 3 4 3 chunks +8 lines, -0 lines 0 comments Download
M chrome/browser/net/predictor_tab_helper.cc View 1 2 3 4 4 chunks +75 lines, -6 lines 0 comments Download
M chrome/common/chrome_switches.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 1 2 3 4 1 chunk +12 lines, -0 lines 0 comments Download
M testing/variations/fieldtrial_testing_config.json View 1 2 3 4 1 chunk +25 lines, -0 lines 0 comments Download
M tools/metrics/histograms/enums.xml View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 38 (31 generated)
horo
falken@ Could you please review this?
3 years, 6 months ago (2017-05-31 16:25:09 UTC) #15
kinuko
https://codereview.chromium.org/2916533002/diff/40001/chrome/browser/net/predictor_tab_helper.cc File chrome/browser/net/predictor_tab_helper.cc (right): https://codereview.chromium.org/2916533002/diff/40001/chrome/browser/net/predictor_tab_helper.cc#newcode125 chrome/browser/net/predictor_tab_helper.cc:125: if (!success || GetNetworkPredictionOptionsForServiceWorker() == Wouldn't this trigger PreconnectUrlWithPredictor ...
3 years, 6 months ago (2017-06-01 05:31:29 UTC) #19
horo
Thank you! https://codereview.chromium.org/2916533002/diff/40001/chrome/browser/net/predictor_tab_helper.cc File chrome/browser/net/predictor_tab_helper.cc (right): https://codereview.chromium.org/2916533002/diff/40001/chrome/browser/net/predictor_tab_helper.cc#newcode125 chrome/browser/net/predictor_tab_helper.cc:125: if (!success || GetNetworkPredictionOptionsForServiceWorker() == On 2017/06/01 ...
3 years, 6 months ago (2017-06-01 05:52:55 UTC) #21
falken
We should also write a design doc for this. https://codereview.chromium.org/2916533002/diff/60001/chrome/browser/net/predictor_tab_helper.cc File chrome/browser/net/predictor_tab_helper.cc (right): https://codereview.chromium.org/2916533002/diff/60001/chrome/browser/net/predictor_tab_helper.cc#newcode119 chrome/browser/net/predictor_tab_helper.cc:119: ...
3 years, 6 months ago (2017-06-01 06:54:17 UTC) #23
horo
https://codereview.chromium.org/2916533002/diff/60001/chrome/browser/net/predictor_tab_helper.cc File chrome/browser/net/predictor_tab_helper.cc (right): https://codereview.chromium.org/2916533002/diff/60001/chrome/browser/net/predictor_tab_helper.cc#newcode119 chrome/browser/net/predictor_tab_helper.cc:119: void PredictorTabHelper::DidStartServiceWorkerForNavigaionPreconnect( On 2017/06/01 06:54:17, falken wrote: > Navigation ...
3 years, 6 months ago (2017-06-01 11:15:07 UTC) #30
falken
Mostly comments, I don't think we necessarily need to update the code. I think there's ...
3 years, 6 months ago (2017-06-01 23:24:14 UTC) #33
horo
3 years, 6 months ago (2017-06-08 08:31:31 UTC) #34
This CL is trying to add two optimizations:
[1]. Start the Service Worker earlier by ignores the SiteInstance's isolation by
     calling AddProcessReferenceToPattern().
[2]. Defer the preconnection to reduce the IO thread contention while starting
     the service worker.

But after inspecting the behavior of PlzNavigate on a low end device, I noticed
that if PlzNavigate is enabled and we can't ignore the SiteInstance's isolation,
these optimizations doesn't have big impact.
To start the service worker in a correct renderer process, we have to wait for
NavigationRequest::OnStartChecksComplete which calls
AddExpectedNavigationToSite.
So we can't start the service worker so earlier.

And also if a new renderer is created for the navigation, the IO thread
contention will not be in the critical path, because the process creation is
far more time consuming. And I think preconnection while starting a new process
looks reasonable. 

For navigations which don't create new renderer, the optimization [2] may have
a impact. But it is difficult to know whether the navigation is creating a new
process or not from WebContentsObserver.

Powered by Google App Engine
This is Rietveld 408576698