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

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

Issue 355163003: Don't prematurely delete script resources when registration is deleted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_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/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 ServiceWorkerRegistration::ServiceWorkerRegistration( 13 ServiceWorkerRegistration::ServiceWorkerRegistration(
14 const GURL& pattern, 14 const GURL& pattern,
15 const GURL& script_url, 15 const GURL& script_url,
16 int64 registration_id, 16 int64 registration_id,
17 base::WeakPtr<ServiceWorkerContextCore> context) 17 base::WeakPtr<ServiceWorkerContextCore> context)
18 : pattern_(pattern), 18 : pattern_(pattern),
19 script_url_(script_url), 19 script_url_(script_url),
20 registration_id_(registration_id), 20 registration_id_(registration_id),
21 is_shutdown_(false), 21 is_uninstalling_(false),
22 context_(context) { 22 context_(context) {
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
24 DCHECK(context_); 24 DCHECK(context_);
25 context_->AddLiveRegistration(this); 25 context_->AddLiveRegistration(this);
26 } 26 }
27 27
28 ServiceWorkerRegistration::~ServiceWorkerRegistration() { 28 ServiceWorkerRegistration::~ServiceWorkerRegistration() {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
30 if (context_) 30 if (context_)
31 context_->RemoveLiveRegistration(registration_id_); 31 context_->RemoveLiveRegistration(registration_id_);
(...skipping 18 matching lines...) Expand all
50 50
51 void ServiceWorkerRegistration::ActivateWaitingVersion() { 51 void ServiceWorkerRegistration::ActivateWaitingVersion() {
52 active_version_->SetStatus(ServiceWorkerVersion::REDUNDANT); 52 active_version_->SetStatus(ServiceWorkerVersion::REDUNDANT);
53 active_version_ = waiting_version_; 53 active_version_ = waiting_version_;
54 // TODO(kinuko): This should be set to ACTIVATING until activation finishes. 54 // TODO(kinuko): This should be set to ACTIVATING until activation finishes.
55 active_version_->SetStatus(ServiceWorkerVersion::ACTIVE); 55 active_version_->SetStatus(ServiceWorkerVersion::ACTIVE);
56 waiting_version_ = NULL; 56 waiting_version_ = NULL;
57 } 57 }
58 58
59 } // namespace content 59 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698