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

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

Issue 377153003: Service Worker: set active worker to REDUNDANT when unregistered (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 5 months 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 | Annotate | Revision Log
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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 CompleteInternal(status); 383 CompleteInternal(status);
384 context_->job_coordinator()->FinishJob(pattern_, this); 384 context_->job_coordinator()->FinishJob(pattern_, this);
385 } 385 }
386 386
387 void ServiceWorkerRegisterJob::CompleteInternal( 387 void ServiceWorkerRegisterJob::CompleteInternal(
388 ServiceWorkerStatusCode status) { 388 ServiceWorkerStatusCode status) {
389 SetPhase(COMPLETE); 389 SetPhase(COMPLETE);
390 if (status != SERVICE_WORKER_OK) { 390 if (status != SERVICE_WORKER_OK) {
391 if (registration()) { 391 if (registration()) {
392 if (new_version()) { 392 if (new_version()) {
393 new_version()->SetStatus(ServiceWorkerVersion::REDUNDANT);
394 DisassociateVersionFromDocuments(context_, new_version()); 393 DisassociateVersionFromDocuments(context_, new_version());
395 registration()->UnsetVersion(new_version()); 394 registration()->UnsetVersion(new_version());
395 new_version()->Doom();
396 } 396 }
397 if (!registration()->active_version()) { 397 if (!registration()->active_version()) {
398 context_->storage()->DeleteRegistration( 398 context_->storage()->DeleteRegistration(
399 registration()->id(), 399 registration()->id(),
400 registration()->script_url().GetOrigin(), 400 registration()->script_url().GetOrigin(),
401 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 401 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
402 } 402 }
403 } 403 }
404 if (!is_promise_resolved_) 404 if (!is_promise_resolved_)
405 ResolvePromise(status, NULL, NULL); 405 ResolvePromise(status, NULL, NULL);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 DCHECK(context); 511 DCHECK(context);
512 for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = 512 for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
513 context->GetProviderHostIterator(); 513 context->GetProviderHostIterator();
514 !it->IsAtEnd(); it->Advance()) { 514 !it->IsAtEnd(); it->Advance()) {
515 ServiceWorkerProviderHost* host = it->GetProviderHost(); 515 ServiceWorkerProviderHost* host = it->GetProviderHost();
516 host->UnsetVersion(version); 516 host->UnsetVersion(version);
517 } 517 }
518 } 518 }
519 519
520 } // namespace content 520 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698