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

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: 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. 269 // Only provider hots are currently using this registeration will change the
270 // controller.
falken 2014/12/15 02:29:25 nit: This comment probably works better in OnSkipp
xiang 2014/12/15 06:00:52 Done.
270 if (activating_version->skip_waiting()) 271 if (activating_version->skip_waiting())
271 FOR_EACH_OBSERVER(Listener, listeners_, OnSkippedWaiting(this)); 272 FOR_EACH_OBSERVER(Listener, listeners_, OnSkippedWaiting(this));
272 273
273 // "10. Queue a task to fire an event named activate..." 274 // "10. Queue a task to fire an event named activate..."
274 activating_version->DispatchActivateEvent( 275 activating_version->DispatchActivateEvent(
275 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished, 276 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished,
276 this, activating_version)); 277 this, activating_version));
277 } 278 }
278 279
279 void ServiceWorkerRegistration::OnActivateEventFinished( 280 void ServiceWorkerRegistration::OnActivateEventFinished(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (!context_) { 356 if (!context_) {
356 callback.Run(SERVICE_WORKER_ERROR_ABORT); 357 callback.Run(SERVICE_WORKER_ERROR_ABORT);
357 return; 358 return;
358 } 359 }
359 context_->storage()->NotifyDoneInstallingRegistration( 360 context_->storage()->NotifyDoneInstallingRegistration(
360 this, version.get(), status); 361 this, version.get(), status);
361 callback.Run(status); 362 callback.Run(status);
362 } 363 }
363 364
364 } // namespace content 365 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698