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 2645493002: Increase the lifetime of Navigation Preload related objects. (Closed)

Created:
3 years, 11 months ago by horo
Modified:
3 years, 11 months ago
Reviewers:
falken, haraken
CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, kenjibaheux+watch_chromium.org, mlamouri+watch-content_chromium.org, shimazu+serviceworker_chromium.org, serviceworker-reviews, jam, nhiroki, kinuko+serviceworker, jshin+watch_chromium.org, horo+watch_chromium.org, blink-reviews, darin-cc_chromium.org, kinuko+watch, tzik, falken+watch_chromium.org, blink-worker-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Increase the lifetime of Navigation Preload related objects. In the current implementation, the navigation preload requests are canceled when the FetchEvent finished. But in this behavior, "event.respondWith(event.preloadResponse);" doesn't work well if the response is bigger than the buffer size or the response stream was flushed. To fix this, this cl changes the lifetime of the the ServiceWorkerContextClient::NavigationPreloadRequest in the Service Worker thread and the mojom::URLLoader related objects in the browser process. ServiceWorkerContextClient::NavigationPreloadRequest will be deleted when it's OnReceiveRedirect() or OnComplete() are called. The mojom::URLLoader related objects in the browser process will be deleted when both the ServiceWorkerURLRequestJob and the FetchEvent finished. BUG=649558 Review-Url: https://codereview.chromium.org/2645493002 Cr-Commit-Position: refs/heads/master@{#444690} Committed: https://chromium.googlesource.com/chromium/src/+/6d38a91f37e0a80f708320ca7fb47aabc0288b16

Patch Set 1 #

Patch Set 2 : check fetchEvent in ServiceWorkerGlobalScopeProxy::onNavigationPreloadError #

Total comments: 22

Patch Set 3 : incorporated falken's comment #

Total comments: 4

Patch Set 4 : incorporated falken's comment #

Patch Set 5 : send abort error and fix flaky test and add abort-when-responded layouttest #

Total comments: 2

Patch Set 6 : Keep the URL loader related assetsalive while the FetchEvent is onging. #

Total comments: 8

Patch Set 7 : incorporated falken's comment #

Patch Set 8 : fix broken-chunked-encoding-worker.js #

Total comments: 2

Patch Set 9 : fix broken-chunked-encoding-worker.js #

Unified diffs Side-by-side diffs Delta from patch set Stats (+200 lines, -124 lines) Patch
M content/browser/service_worker/service_worker_browsertest.cc View 5 1 chunk +0 lines, -60 lines 0 comments Download
M content/browser/service_worker/service_worker_fetch_dispatcher.h View 1 2 3 4 5 6 4 chunks +12 lines, -3 lines 0 comments Download
M content/browser/service_worker/service_worker_fetch_dispatcher.cc View 1 2 3 4 5 6 9 chunks +61 lines, -29 lines 0 comments Download
M content/browser/service_worker/service_worker_url_request_job.cc View 1 2 3 4 5 6 1 chunk +7 lines, -1 line 0 comments Download
M content/renderer/service_worker/service_worker_context_client.h View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M content/renderer/service_worker/service_worker_context_client.cc View 1 2 3 4 5 6 8 chunks +19 lines, -30 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/broken-chunked-encoding.html View 1 2 3 4 5 6 7 1 chunk +25 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chunked-encoding.html View 1 2 3 4 1 chunk +25 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-scope.php View 1 1 chunk +5 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js View 1 2 3 4 5 6 7 8 1 chunk +11 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/chunked-encoding-scope.php View 1 2 1 chunk +17 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/chunked-encoding-worker.js View 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp View 1 1 chunk +3 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 72 (53 generated)
horo
falken@ Could you please review this?
3 years, 11 months ago (2017-01-18 12:56:22 UTC) #13
falken
https://codereview.chromium.org/2645493002/diff/80001/content/browser/service_worker/service_worker_url_request_job.cc File content/browser/service_worker/service_worker_url_request_job.cc (right): https://codereview.chromium.org/2645493002/diff/80001/content/browser/service_worker/service_worker_url_request_job.cc#newcode568 content/browser/service_worker/service_worker_url_request_job.cc:568: // Do not clear |fetch_dispatcher_| if it has dispached ...
3 years, 11 months ago (2017-01-18 14:24:59 UTC) #17
horo
https://codereview.chromium.org/2645493002/diff/80001/content/browser/service_worker/service_worker_url_request_job.cc File content/browser/service_worker/service_worker_url_request_job.cc (right): https://codereview.chromium.org/2645493002/diff/80001/content/browser/service_worker/service_worker_url_request_job.cc#newcode568 content/browser/service_worker/service_worker_url_request_job.cc:568: // Do not clear |fetch_dispatcher_| if it has dispached ...
3 years, 11 months ago (2017-01-18 16:14:57 UTC) #20
falken
lgtm, thanks https://codereview.chromium.org/2645493002/diff/80001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js File third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js (right): https://codereview.chromium.org/2645493002/diff/80001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js#newcode9 third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js:9: .then(text => new Response('Done'))); On 2017/01/18 16:14:57, ...
3 years, 11 months ago (2017-01-18 16:32:58 UTC) #21
horo
Thank you! https://codereview.chromium.org/2645493002/diff/80001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js File third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js (right): https://codereview.chromium.org/2645493002/diff/80001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js#newcode9 third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js:9: .then(text => new Response('Done'))); On 2017/01/18 16:32:57, ...
3 years, 11 months ago (2017-01-18 16:52:06 UTC) #23
horo
haraken@ Could you please review third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp?
3 years, 11 months ago (2017-01-18 16:54:18 UTC) #26
horo
falken@ I noticed that Patch Set 3 has a bug that ServiceWorkerContextClient::NavigationPreloadRequest is not released ...
3 years, 11 months ago (2017-01-18 23:51:48 UTC) #35
haraken
LGTM
3 years, 11 months ago (2017-01-18 23:55:46 UTC) #36
falken
https://codereview.chromium.org/2645493002/diff/160001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html File third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html (right): https://codereview.chromium.org/2645493002/diff/160001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html#newcode34 third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html:34: 'network error.'); Testing the error string isn't right for ...
3 years, 11 months ago (2017-01-19 01:27:37 UTC) #37
horo
I changed ServiceWorkerFetchDispatcher to keep the URL loader related assets alive while the FetchEvent is ...
3 years, 11 months ago (2017-01-19 03:41:01 UTC) #49
falken
lgtm https://codereview.chromium.org/2645493002/diff/220001/content/browser/service_worker/service_worker_fetch_dispatcher.cc File content/browser/service_worker/service_worker_fetch_dispatcher.cc (right): https://codereview.chromium.org/2645493002/diff/220001/content/browser/service_worker/service_worker_fetch_dispatcher.cc#newcode356 content/browser/service_worker/service_worker_fetch_dispatcher.cc:356: // assets alive while the FetchEvent is onging ...
3 years, 11 months ago (2017-01-19 05:26:47 UTC) #52
horo
Thank you https://codereview.chromium.org/2645493002/diff/220001/content/browser/service_worker/service_worker_fetch_dispatcher.cc File content/browser/service_worker/service_worker_fetch_dispatcher.cc (right): https://codereview.chromium.org/2645493002/diff/220001/content/browser/service_worker/service_worker_fetch_dispatcher.cc#newcode356 content/browser/service_worker/service_worker_fetch_dispatcher.cc:356: // assets alive while the FetchEvent is ...
3 years, 11 months ago (2017-01-19 05:48:57 UTC) #53
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/2645493002/240001
3 years, 11 months ago (2017-01-19 05:49:22 UTC) #56
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/371779)
3 years, 11 months ago (2017-01-19 07:26:39 UTC) #58
horo
Ah, after this patch https://codereview.chromium.org/2633123002/, OnComplete() with an error is called before OnStartLoadingResponseBody() in broken-chunked-encoding.html ...
3 years, 11 months ago (2017-01-19 08:02:22 UTC) #64
falken
lgtm https://codereview.chromium.org/2645493002/diff/270001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js File third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js (right): https://codereview.chromium.org/2645493002/diff/270001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js#newcode9 third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js:9: .catch(_ => new Response('Done'))); I'd slightly prefer writing ...
3 years, 11 months ago (2017-01-19 08:09:53 UTC) #65
horo
Thank you! https://codereview.chromium.org/2645493002/diff/270001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js File third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js (right): https://codereview.chromium.org/2645493002/diff/270001/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js#newcode9 third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/broken-chunked-encoding-worker.js:9: .catch(_ => new Response('Done'))); On 2017/01/19 08:09:52, ...
3 years, 11 months ago (2017-01-19 08:12:01 UTC) #66
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/2645493002/290001
3 years, 11 months ago (2017-01-19 08:12:27 UTC) #69
commit-bot: I haz the power
3 years, 11 months ago (2017-01-19 09:42:17 UTC) #72
Message was sent while issue was closed.
Committed patchset #9 (id:290001) as
https://chromium.googlesource.com/chromium/src/+/6d38a91f37e0a80f708320ca7fb4...

Powered by Google App Engine
This is Rietveld 408576698