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

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

Issue 2469203002: ServiceWorker: Let dtor of SWRegistration work in the shutdown sequence (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 7 #include <vector>
8 8
9 #include "content/browser/service_worker/embedded_worker_status.h" 9 #include "content/browser/service_worker/embedded_worker_status.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 resources_total_size_bytes_(0), 42 resources_total_size_bytes_(0),
43 context_(context), 43 context_(context),
44 task_runner_(base::ThreadTaskRunnerHandle::Get()) { 44 task_runner_(base::ThreadTaskRunnerHandle::Get()) {
45 DCHECK_CURRENTLY_ON(BrowserThread::IO); 45 DCHECK_CURRENTLY_ON(BrowserThread::IO);
46 DCHECK_NE(kInvalidServiceWorkerRegistrationId, registration_id); 46 DCHECK_NE(kInvalidServiceWorkerRegistrationId, registration_id);
47 DCHECK(context_); 47 DCHECK(context_);
48 context_->AddLiveRegistration(this); 48 context_->AddLiveRegistration(this);
49 } 49 }
50 50
51 ServiceWorkerRegistration::~ServiceWorkerRegistration() { 51 ServiceWorkerRegistration::~ServiceWorkerRegistration() {
52 // Can be false during shutdown, in which case the DCHECK_CURRENTLY_ON below
53 // would cry.
54 if (!BrowserThread::IsThreadInitialized(BrowserThread::IO))
55 return;
56
57 DCHECK_CURRENTLY_ON(BrowserThread::IO); 52 DCHECK_CURRENTLY_ON(BrowserThread::IO);
58 DCHECK(!listeners_.might_have_observers()); 53 DCHECK(!listeners_.might_have_observers());
59 if (context_) 54 if (context_)
60 context_->RemoveLiveRegistration(registration_id_); 55 context_->RemoveLiveRegistration(registration_id_);
61 if (active_version()) 56 if (active_version())
62 active_version()->RemoveListener(this); 57 active_version()->RemoveListener(this);
63 } 58 }
64 59
65 ServiceWorkerVersion* ServiceWorkerRegistration::GetNewestVersion() const { 60 ServiceWorkerVersion* ServiceWorkerRegistration::GetNewestVersion() const {
66 if (installing_version()) 61 if (installing_version())
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (!context_) { 510 if (!context_) {
516 callback.Run(SERVICE_WORKER_ERROR_ABORT); 511 callback.Run(SERVICE_WORKER_ERROR_ABORT);
517 return; 512 return;
518 } 513 }
519 context_->storage()->NotifyDoneInstallingRegistration( 514 context_->storage()->NotifyDoneInstallingRegistration(
520 this, version.get(), status); 515 this, version.get(), status);
521 callback.Run(status); 516 callback.Run(status);
522 } 517 }
523 518
524 } // namespace content 519 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698