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

Side by Side Diff: content/browser/service_worker/service_worker_registration.cc

Issue 798833002: ServiceWorker: Make skipWaiting only works on documents using current registration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: edit comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_registration.h" 5 #include "content/browser/service_worker/service_worker_registration.h"
6 6
7 #include "content/browser/service_worker/service_worker_context_core.h" 7 #include "content/browser/service_worker/service_worker_context_core.h"
8 #include "content/browser/service_worker/service_worker_info.h" 8 #include "content/browser/service_worker/service_worker_info.h"
9 #include "content/browser/service_worker/service_worker_register_job.h" 9 #include "content/browser/service_worker/service_worker_register_job.h"
10 #include "content/browser/service_worker/service_worker_utils.h" 10 #include "content/browser/service_worker/service_worker_utils.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 260
261 // "6. Set serviceWorkerRegistration.activeWorker to activatingWorker." 261 // "6. Set serviceWorkerRegistration.activeWorker to activatingWorker."
262 // "7. Set serviceWorkerRegistration.waitingWorker to null." 262 // "7. Set serviceWorkerRegistration.waitingWorker to null."
263 SetActiveVersion(activating_version.get()); 263 SetActiveVersion(activating_version.get());
264 264
265 // "8. Run the [[UpdateState]] algorithm passing registration.activeWorker and 265 // "8. Run the [[UpdateState]] algorithm passing registration.activeWorker and
266 // "activating" as arguments." 266 // "activating" as arguments."
267 activating_version->SetStatus(ServiceWorkerVersion::ACTIVATING); 267 activating_version->SetStatus(ServiceWorkerVersion::ACTIVATING);
268 // "9. Fire a simple event named controllerchange..." 268 // "9. Fire a simple event named controllerchange..."
269 // Notify associated provider hosts to change the controller.
270 if (activating_version->skip_waiting()) 269 if (activating_version->skip_waiting())
271 FOR_EACH_OBSERVER(Listener, listeners_, OnSkippedWaiting(this)); 270 FOR_EACH_OBSERVER(Listener, listeners_, OnSkippedWaiting(this));
272 271
273 // "10. Queue a task to fire an event named activate..." 272 // "10. Queue a task to fire an event named activate..."
274 activating_version->DispatchActivateEvent( 273 activating_version->DispatchActivateEvent(
275 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished, 274 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished,
276 this, activating_version)); 275 this, activating_version));
277 } 276 }
278 277
279 void ServiceWorkerRegistration::OnActivateEventFinished( 278 void ServiceWorkerRegistration::OnActivateEventFinished(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (!context_) { 354 if (!context_) {
356 callback.Run(SERVICE_WORKER_ERROR_ABORT); 355 callback.Run(SERVICE_WORKER_ERROR_ABORT);
357 return; 356 return;
358 } 357 }
359 context_->storage()->NotifyDoneInstallingRegistration( 358 context_->storage()->NotifyDoneInstallingRegistration(
360 this, version.get(), status); 359 this, version.get(), status);
361 callback.Run(status); 360 callback.Run(status);
362 } 361 }
363 362
364 } // namespace content 363 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698