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

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

Issue 717353004: ServiceWorker: Add support for .skipWaiting and controllerchange event(2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again 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_register_job.h" 5 #include "content/browser/service_worker/service_worker_register_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 420
421 // "10. Set registration.waitingWorker to registration.installingWorker." 421 // "10. Set registration.waitingWorker to registration.installingWorker."
422 // "11. Set registration.installingWorker to null." 422 // "11. Set registration.installingWorker to null."
423 registration()->SetWaitingVersion(new_version()); 423 registration()->SetWaitingVersion(new_version());
424 424
425 // "12. Run the [[UpdateState]] algorithm passing registration.waitingWorker 425 // "12. Run the [[UpdateState]] algorithm passing registration.waitingWorker
426 // and "installed" as the arguments." 426 // and "installed" as the arguments."
427 new_version()->SetStatus(ServiceWorkerVersion::INSTALLED); 427 new_version()->SetStatus(ServiceWorkerVersion::INSTALLED);
428 428
429 // TODO(michaeln): "13. If activateImmediate is true, then..." 429 // "If registration's waiting worker's skip waiting flag is set:" then
430 430 // activate the worker immediately otherwise "wait until no service worker
431 // "14. Wait until no document is using registration as their 431 // client is using registration as their service worker registration."
432 // Service Worker registration."
433 registration()->ActivateWaitingVersionWhenReady(); 432 registration()->ActivateWaitingVersionWhenReady();
434 433
435 Complete(SERVICE_WORKER_OK); 434 Complete(SERVICE_WORKER_OK);
436 } 435 }
437 436
438 void ServiceWorkerRegisterJob::Complete(ServiceWorkerStatusCode status) { 437 void ServiceWorkerRegisterJob::Complete(ServiceWorkerStatusCode status) {
439 CompleteInternal(status); 438 CompleteInternal(status);
440 context_->job_coordinator()->FinishJob(pattern_, this); 439 context_->job_coordinator()->FinishJob(pattern_, this);
441 } 440 }
442 441
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 ServiceWorkerProviderHost* host = it->GetProviderHost(); 550 ServiceWorkerProviderHost* host = it->GetProviderHost();
552 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), 551 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(),
553 host->document_url())) { 552 host->document_url())) {
554 if (host->CanAssociateRegistration(registration)) 553 if (host->CanAssociateRegistration(registration))
555 host->AssociateRegistration(registration); 554 host->AssociateRegistration(registration);
556 } 555 }
557 } 556 }
558 } 557 }
559 558
560 } // namespace content 559 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698