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

Issue 2034663002: ServiceWorker: Keep the worker alive until FetchEvent.waitUntil settles (Closed)

Created:
4 years, 6 months ago by shimazu
Modified:
4 years, 5 months ago
CC:
asvitkine+watch_chromium.org, blink-reviews, blink-reviews-api_chromium.org, blink-worker-reviews_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, falken, haraken, horo+watch_chromium.org, jam, jsbell+serviceworker_chromium.org, kinuko+watch, kinuko+serviceworker, michaeln, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, nhiroki, serviceworker-reviews, tzik
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

ServiceWorker: Keep the worker alive until FetchEvent.waitUntil settles Currently ServiceWorker doesn't track if FetchEvent.waitUntil is finished, so worker will be shutted down by idle timeout though a heavy task is running. This patch adds WaitUntilObserver and makes RespondWith collaborate with it in order to keep the worker alive. BUG=601095 TEST=./out/Release/content_unittests --gtest_filter="ServiceWorkerURLRequestJobTest.*" TEST=./out/Release/content_unittests --gtest_filter="ServiceWorkerVersionTest.*" Committed: https://crrev.com/3f122ea68eb653a175edc74ce5dbf9e8ba344e5e Cr-Commit-Position: refs/heads/master@{#402710}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Separate DispathEvent into two part #

Total comments: 20

Patch Set 3 : Rebase #

Patch Set 4 : Use std::vector, rename the variables, set the initializer value and format #

Patch Set 5 : Rebase #

Total comments: 24

Patch Set 6 : Fix the name of variables and comments #

Total comments: 4

Patch Set 7 : Rebase #

Total comments: 32

Patch Set 8 : Fix the names, update some comments and add ForeignFetch_WaitUntil #

Patch Set 9 : Let the argument false and add comments #

Patch Set 10 : Add an inline comment #

Total comments: 10

Patch Set 11 : Fix the comment and remove extra decrementPendingActivity #

Total comments: 4

Patch Set 12 : Fix the nits #

Patch Set 13 : Add incrementPendingActivity #

Patch Set 14 : Add FOREIGH_FETCH_WAITUNTIL to histograms.xml #

Patch Set 15 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+484 lines, -155 lines) Patch
M content/browser/service_worker/embedded_worker_test_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +4 lines, -2 lines 0 comments Download
M content/browser/service_worker/embedded_worker_test_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +13 lines, -7 lines 0 comments Download
M content/browser/service_worker/service_worker_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +6 lines, -3 lines 0 comments Download
M content/browser/service_worker/service_worker_fetch_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +21 lines, -5 lines 0 comments Download
M content/browser/service_worker/service_worker_metrics.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_metrics.cc View 1 2 3 4 5 6 7 4 chunks +16 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_register_job.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +6 lines, -4 lines 0 comments Download
M content/browser/service_worker/service_worker_url_request_job_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +87 lines, -10 lines 0 comments Download
M content/browser/service_worker/service_worker_version.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +53 lines, -30 lines 0 comments Download
M content/browser/service_worker/service_worker_version.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +21 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_version_unittest.cc View 1 2 3 4 5 6 7 5 chunks +80 lines, -12 lines 0 comments Download
M content/common/service_worker/service_worker_messages.h View 1 2 3 4 5 6 7 2 chunks +8 lines, -4 lines 0 comments Download
M content/renderer/service_worker/service_worker_context_client.h View 1 2 3 4 5 6 7 2 chunks +8 lines, -4 lines 0 comments Download
M content/renderer/service_worker/service_worker_context_client.cc View 1 2 3 4 5 6 7 4 chunks +18 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h View 1 2 3 chunks +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp View 1 2 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ForeignFetchEvent.h View 1 2 3 chunks +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ForeignFetchEvent.cpp View 1 2 3 chunks +6 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ForeignFetchRespondWithObserver.h View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ForeignFetchRespondWithObserver.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h View 1 2 3 4 5 6 7 4 chunks +10 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +20 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h View 3 chunks +7 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp View 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp View 1 2 3 4 5 6 7 1 chunk +9 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +18 lines, -8 lines 0 comments Download
M third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h View 1 2 3 4 5 6 7 1 chunk +9 lines, -5 lines 0 comments Download
M third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextProxy.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +23 lines, -2 lines 0 comments Download

Messages

Total messages: 39 (11 generated)
shimazu
palmer@chromium.org: Please review changes in IPC keishi@chromium.org: Please review changes in third_party/WebKit/public/web rkaplow@chromium.org: Please review ...
4 years, 6 months ago (2016-06-02 10:11:58 UTC) #2
rkaplow
lgtm histogram lgtm
4 years, 6 months ago (2016-06-02 14:37:09 UTC) #3
Marijn Kruisselbrink
just some random thoughts on possible ways this could be done without having SWVersion know ...
4 years, 6 months ago (2016-06-02 16:58:55 UTC) #5
shimazu
Thanks! I also think it's unfortunate to create the fetch-specific method, so that's very helpful. ...
4 years, 6 months ago (2016-06-03 04:48:40 UTC) #6
shimazu
Following mek@'s comment, I omitted DispatchFetchEvent and separated DispatchEvent into two parts: - RegisterRequestCallback (called ...
4 years, 6 months ago (2016-06-03 10:59:10 UTC) #7
falken
One round of comments. Can you rebase the patch with ToT? I want to load ...
4 years, 6 months ago (2016-06-06 10:01:40 UTC) #9
shimazu
Thanks for your review. I rebased and replied to some comments. For the remaining, I'll ...
4 years, 6 months ago (2016-06-07 02:27:41 UTC) #10
falken
Thanks for rebasing, I actually don't have further comments now. https://codereview.chromium.org/2034663002/diff/20001/content/browser/service_worker/service_worker_version.h File content/browser/service_worker/service_worker_version.h (right): https://codereview.chromium.org/2034663002/diff/20001/content/browser/service_worker/service_worker_version.h#newcode244 ...
4 years, 6 months ago (2016-06-07 07:56:17 UTC) #11
shimazu
Updated the patch. PTAL again! :) https://codereview.chromium.org/2034663002/diff/20001/content/browser/service_worker/embedded_worker_test_helper.cc File content/browser/service_worker/embedded_worker_test_helper.cc (right): https://codereview.chromium.org/2034663002/diff/20001/content/browser/service_worker/embedded_worker_test_helper.cc#newcode234 content/browser/service_worker/embedded_worker_test_helper.cc:234: int finish_request_id, On ...
4 years, 6 months ago (2016-06-09 05:44:21 UTC) #12
falken
I'm still a bit concerned with the naming. We should choose a sensible and consistent ...
4 years, 6 months ago (2016-06-09 19:28:48 UTC) #13
shimazu
Thanks for your review! PTAL again. https://codereview.chromium.org/2034663002/diff/80001/content/browser/service_worker/embedded_worker_test_helper.h File content/browser/service_worker/embedded_worker_test_helper.h (right): https://codereview.chromium.org/2034663002/diff/80001/content/browser/service_worker/embedded_worker_test_helper.h#newcode164 content/browser/service_worker/embedded_worker_test_helper.h:164: int event_request_id, On ...
4 years, 6 months ago (2016-06-10 10:26:50 UTC) #14
palmer
lgtm
4 years, 6 months ago (2016-06-10 19:23:17 UTC) #15
Marijn Kruisselbrink
I like this approach, just some minor nits https://codereview.chromium.org/2034663002/diff/100001/content/browser/service_worker/service_worker_fetch_dispatcher.cc File content/browser/service_worker/service_worker_fetch_dispatcher.cc (right): https://codereview.chromium.org/2034663002/diff/100001/content/browser/service_worker/service_worker_fetch_dispatcher.cc#newcode102 content/browser/service_worker/service_worker_fetch_dispatcher.cc:102: ServiceWorkerMetrics::EventType::FETCH_WAITUNTIL, ...
4 years, 6 months ago (2016-06-15 12:37:07 UTC) #16
falken
This is looking good mod mek's comments and some naming inconsistencies. https://codereview.chromium.org/2034663002/diff/80001/content/browser/service_worker/service_worker_metrics.h File content/browser/service_worker/service_worker_metrics.h (right): ...
4 years, 6 months ago (2016-06-16 06:23:12 UTC) #17
shimazu
Thanks for the review. PTAL again:) rkaplow@, I modified the UMA part again, so could ...
4 years, 6 months ago (2016-06-21 02:43:38 UTC) #18
falken
https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right): https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp#newcode149 third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:149: waitUntilObserver->didDispatchEvent(dispatchResult != DispatchEventResult::NotCanceled); On 2016/06/21 02:43:38, makoto wrote: > ...
4 years, 6 months ago (2016-06-21 04:12:32 UTC) #19
shimazu
https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right): https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp#newcode149 third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:149: waitUntilObserver->didDispatchEvent(dispatchResult != DispatchEventResult::NotCanceled); On 2016/06/21 04:12:32, falken wrote: > ...
4 years, 6 months ago (2016-06-21 10:00:36 UTC) #20
Marijn Kruisselbrink
https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right): https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp#newcode149 third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:149: waitUntilObserver->didDispatchEvent(dispatchResult != DispatchEventResult::NotCanceled); Note that there is also a ...
4 years, 6 months ago (2016-06-21 17:32:15 UTC) #21
falken
just some nits and one question https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right): https://codereview.chromium.org/2034663002/diff/120001/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp#newcode149 third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:149: waitUntilObserver->didDispatchEvent(dispatchResult != DispatchEventResult::NotCanceled); ...
4 years, 6 months ago (2016-06-22 01:27:32 UTC) #22
shimazu
Thanks, fix it. PTAL again. https://codereview.chromium.org/2034663002/diff/180001/content/browser/service_worker/service_worker_metrics.h File content/browser/service_worker/service_worker_metrics.h (right): https://codereview.chromium.org/2034663002/diff/180001/content/browser/service_worker/service_worker_metrics.h#newcode84 content/browser/service_worker/service_worker_metrics.h:84: // has only one ...
4 years, 6 months ago (2016-06-22 05:41:27 UTC) #24
falken
LGTM! https://codereview.chromium.org/2034663002/diff/220001/content/browser/service_worker/service_worker_metrics.h File content/browser/service_worker/service_worker_metrics.h (right): https://codereview.chromium.org/2034663002/diff/220001/content/browser/service_worker/service_worker_metrics.h#newcode84 content/browser/service_worker/service_worker_metrics.h:84: // have only one request that starts event ...
4 years, 6 months ago (2016-06-22 05:53:33 UTC) #25
shimazu
https://codereview.chromium.org/2034663002/diff/220001/content/browser/service_worker/service_worker_metrics.h File content/browser/service_worker/service_worker_metrics.h (right): https://codereview.chromium.org/2034663002/diff/220001/content/browser/service_worker/service_worker_metrics.h#newcode84 content/browser/service_worker/service_worker_metrics.h:84: // have only one request that starts event and ...
4 years, 6 months ago (2016-06-22 07:13:39 UTC) #26
shimazu
rkaplow@: I modified the UMA part again, so could you take a look? keishi@: could ...
4 years, 6 months ago (2016-06-24 01:30:01 UTC) #27
keishi
LGTM Source/web/
4 years, 6 months ago (2016-06-24 12:24:00 UTC) #28
rkaplow
lgtm
4 years, 5 months ago (2016-06-28 14:33:02 UTC) #29
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/2034663002/300001
4 years, 5 months ago (2016-06-29 01:47:11 UTC) #35
commit-bot: I haz the power
Committed patchset #15 (id:300001)
4 years, 5 months ago (2016-06-29 04:12:54 UTC) #37
commit-bot: I haz the power
4 years, 5 months ago (2016-06-29 04:15:03 UTC) #39
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/3f122ea68eb653a175edc74ce5dbf9e8ba344e5e
Cr-Commit-Position: refs/heads/master@{#402710}

Powered by Google App Engine
This is Rietveld 408576698