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

Unified Diff: content/browser/service_worker/service_worker_version.cc

Issue 805083006: Schedule the stop-worker-timer even if the ServiceWorker is controlling pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_version_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index dbdcadb7d501798515791f452f7b7840de24c6ff..66256cd9bc63d3908e33ffc3cd8e125e666824f6 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -596,8 +596,9 @@ void ServiceWorkerVersion::AddControllee(
DCHECK(!ContainsKey(controllee_map_, provider_host));
int controllee_id = controllee_by_id_.Add(provider_host);
controllee_map_[provider_host] = controllee_id;
- if (stop_worker_timer_.IsRunning())
- stop_worker_timer_.Stop();
+ // Reset the timer if it's running (so that it's kept alive a bit longer
+ // right after a new controllee is added).
+ ScheduleStopWorker();
}
void ServiceWorkerVersion::RemoveControllee(
@@ -613,7 +614,9 @@ void ServiceWorkerVersion::RemoveControllee(
DoomInternal();
return;
}
- ScheduleStopWorker();
+ // Schedule the stop-worker-timer if it's not running.
+ if (!stop_worker_timer_.IsRunning())
+ ScheduleStopWorker();
}
void ServiceWorkerVersion::AddListener(Listener* listener) {
@@ -1064,9 +1067,7 @@ void ServiceWorkerVersion::DidSkipWaiting(int request_id) {
}
void ServiceWorkerVersion::ScheduleStopWorker() {
- // TODO(kinuko): Currently we don't schedule stop-time-worker when the SW has
- // controllee, but we should change this default behavior (crbug.com/440259)
- if (running_status() != RUNNING || HasControllee())
+ if (running_status() != RUNNING)
return;
if (stop_worker_timer_.IsRunning()) {
stop_worker_timer_.Reset();
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_version_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698