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

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

Issue 304543002: Show the unregistered workers in chrome://serviceworker-internals and chrome://inspect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass live_registrations to chrome://inspect. Created 6 years, 6 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
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
(...skipping 18 matching lines...) Expand all
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_);
32 } 32 }
33 33
34 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { 34 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() {
35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
36 return ServiceWorkerRegistrationInfo( 36 return ServiceWorkerRegistrationInfo(
37 script_url(), 37 script_url(),
38 pattern(), 38 pattern(),
39 registration_id_,
39 active_version_ ? active_version_->GetInfo() : ServiceWorkerVersionInfo(), 40 active_version_ ? active_version_->GetInfo() : ServiceWorkerVersionInfo(),
40 pending_version_ ? pending_version_->GetInfo() 41 pending_version_ ? pending_version_->GetInfo()
41 : ServiceWorkerVersionInfo()); 42 : ServiceWorkerVersionInfo());
42 } 43 }
43 44
44 ServiceWorkerVersion* ServiceWorkerRegistration::GetNewestVersion() { 45 ServiceWorkerVersion* ServiceWorkerRegistration::GetNewestVersion() {
45 if (active_version()) 46 if (active_version())
46 return active_version(); 47 return active_version();
47 return pending_version(); 48 return pending_version();
48 } 49 }
49 50
50 void ServiceWorkerRegistration::ActivatePendingVersion() { 51 void ServiceWorkerRegistration::ActivatePendingVersion() {
51 active_version_->SetStatus(ServiceWorkerVersion::DEACTIVATED); 52 active_version_->SetStatus(ServiceWorkerVersion::DEACTIVATED);
52 active_version_ = pending_version_; 53 active_version_ = pending_version_;
53 // TODO(kinuko): This should be set to ACTIVATING until activation finishes. 54 // TODO(kinuko): This should be set to ACTIVATING until activation finishes.
54 active_version_->SetStatus(ServiceWorkerVersion::ACTIVE); 55 active_version_->SetStatus(ServiceWorkerVersion::ACTIVE);
55 pending_version_ = NULL; 56 pending_version_ = NULL;
56 } 57 }
57 58
58 } // namespace content 59 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698