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

Issue 272183005: Stop ServiceWorker context when no controllee is associated (and when all refs are dropped) (Closed)

Created:
6 years, 7 months ago by kinuko
Modified:
6 years, 7 months ago
Reviewers:
michaeln, horo
CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, jam, nhiroki, darin-cc_chromium.org, horo+watch_chromium.org, kinuko+watch, alecflett+watch_chromium.org, Jeffrey Yasskin
Visibility:
Public.

Description

Stop ServiceWorker context when no controllee is associated (and when all refs are dropped) Currently we stop the ServiceWorker thread/context when: 1. After all documents that are controlled by the SW are closed, with a delay (5 min) 2. All references to the version are dropped (i.e. in dtor) In the current impl/codebase a worker is immediately stopped by 2 in most cases. The same stop timer (ScheduleStopWorker()) could be probably called each time handling event is finished to stop the worker more aggressively, though this patch doesn't do so. BUG=372673 TEST=tested manually with chrome://serviceworker-internals/ Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=270971

Patch Set 1 #

Total comments: 9

Patch Set 2 : Updated, and updated tests #

Total comments: 11

Patch Set 3 : addressed comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+52 lines, -13 lines) Patch
M content/browser/service_worker/embedded_worker_instance.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/service_worker/embedded_worker_test_helper.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/service_worker/service_worker_context_unittest.cc View 1 4 chunks +16 lines, -3 lines 0 comments Download
M content/browser/service_worker/service_worker_version.h View 4 chunks +5 lines, -1 line 0 comments Download
M content/browser/service_worker/service_worker_version.cc View 1 2 9 chunks +27 lines, -7 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
kinuko
PTL, adding a few very basic callsites to stop workers. (You could wonder why we ...
6 years, 7 months ago (2014-05-14 09:20:31 UTC) #1
horo
lgtm. But to fix the bug http://crbug.com/368570 we should also call StopWorker when RenderProcessHostImpl::FastShutdownIfPossible is ...
6 years, 7 months ago (2014-05-14 11:05:02 UTC) #2
michaeln
https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (left): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#oldcode193 content/browser/service_worker/service_worker_version.cc:193: DCHECK(embedded_worker_); why remove these? https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#newcode116 ...
6 years, 7 months ago (2014-05-14 19:44:23 UTC) #3
kinuko
https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (left): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#oldcode193 content/browser/service_worker/service_worker_version.cc:193: DCHECK(embedded_worker_); On 2014/05/14 19:44:23, michaeln wrote: > why remove ...
6 years, 7 months ago (2014-05-14 21:56:29 UTC) #4
kinuko
https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#newcode116 content/browser/service_worker/service_worker_version.cc:116: embedded_worker_->Stop(); On 2014/05/14 21:56:30, kinuko wrote: > On 2014/05/14 ...
6 years, 7 months ago (2014-05-14 22:00:25 UTC) #5
michaeln
https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (left): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#oldcode193 content/browser/service_worker/service_worker_version.cc:193: DCHECK(embedded_worker_); > Since we no longer reset embedded_worker_ anywhere ...
6 years, 7 months ago (2014-05-14 23:20:21 UTC) #6
kinuko
https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#newcode116 content/browser/service_worker/service_worker_version.cc:116: embedded_worker_->Stop(); On 2014/05/14 23:20:21, michaeln wrote: > i was ...
6 years, 7 months ago (2014-05-14 23:50:06 UTC) #7
kinuko
> But to fix the bug http://crbug.com/368570 we should also call StopWorker when > RenderProcessHostImpl::FastShutdownIfPossible ...
6 years, 7 months ago (2014-05-15 17:17:00 UTC) #8
kinuko
https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/272183005/diff/1/content/browser/service_worker/service_worker_version.cc#newcode116 content/browser/service_worker/service_worker_version.cc:116: embedded_worker_->Stop(); On 2014/05/14 23:20:21, michaeln wrote: > i was ...
6 years, 7 months ago (2014-05-15 17:17:25 UTC) #9
michaeln
lgtm, please see the comment about possibly simplifiying the dtor https://codereview.chromium.org/272183005/diff/20001/content/browser/service_worker/embedded_worker_instance.cc File content/browser/service_worker/embedded_worker_instance.cc (right): https://codereview.chromium.org/272183005/diff/20001/content/browser/service_worker/embedded_worker_instance.cc#newcode25 ...
6 years, 7 months ago (2014-05-15 19:02:20 UTC) #10
Jeffrey Yasskin
https://codereview.chromium.org/272183005/diff/20001/content/browser/service_worker/service_worker_version.cc File content/browser/service_worker/service_worker_version.cc (right): https://codereview.chromium.org/272183005/diff/20001/content/browser/service_worker/service_worker_version.cc#newcode30 content/browser/service_worker/service_worker_version.cc:30: const int64 kStopWorkerDelay = 5 * 60; // 5 ...
6 years, 7 months ago (2014-05-15 19:16:44 UTC) #11
kinuko
Thanks. We seem to have a few TODOs but let me land this now (so ...
6 years, 7 months ago (2014-05-16 04:13:51 UTC) #12
kinuko
The CQ bit was checked by kinuko@chromium.org
6 years, 7 months ago (2014-05-16 04:14:02 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kinuko@chromium.org/272183005/40001
6 years, 7 months ago (2014-05-16 04:14:09 UTC) #14
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-16 07:28:43 UTC) #15
commit-bot: I haz the power
Change committed as 270971
6 years, 7 months ago (2014-05-16 09:16:21 UTC) #16
Adrian Kuegel
6 years, 7 months ago (2014-05-16 09:52:36 UTC) #17
Message was sent while issue was closed.
A revert of this CL has been created in
https://codereview.chromium.org/286203008/ by akuegel@chromium.org.

The reason for reverting is: Has memory leaks in
EmbeddedWorkerInstanceTest.InstanceDestroyedBeforeStartFinishes.

Powered by Google App Engine
This is Rietveld 408576698