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

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

Issue 140743012: Start EmbeddedWorker during registration - take 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 ServiceWorkerRegistration::ServiceWorkerRegistration(const GURL& pattern, 11 ServiceWorkerRegistration::ServiceWorkerRegistration(const GURL& pattern,
12 const GURL& script_url, 12 const GURL& script_url,
13 int64 registration_id) 13 int64 registration_id)
14 : pattern_(pattern), 14 : pattern_(pattern),
15 script_url_(script_url), 15 script_url_(script_url),
16 registration_id_(registration_id), 16 registration_id_(registration_id),
17 next_version_id_(0L),
17 is_shutdown_(false) { 18 is_shutdown_(false) {
18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 19 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
20 LOG(ERROR) << "Created registration for (" << pattern << "," << script_url
21 << ")";
19 } 22 }
20 23
21 ServiceWorkerRegistration::~ServiceWorkerRegistration() { 24 ServiceWorkerRegistration::~ServiceWorkerRegistration() {
22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
23 DCHECK(is_shutdown_); 26 DCHECK(is_shutdown_);
24 } 27 }
25 28
26 void ServiceWorkerRegistration::Shutdown() { 29 void ServiceWorkerRegistration::Shutdown() {
27 DCHECK(!is_shutdown_); 30 DCHECK(!is_shutdown_);
28 if (active_version_) 31 if (active_version_)
29 active_version_->Shutdown(); 32 active_version_->Shutdown();
30 active_version_ = NULL; 33 active_version_ = NULL;
31 if (pending_version_) 34 if (pending_version_)
32 pending_version_->Shutdown(); 35 pending_version_->Shutdown();
33 pending_version_ = NULL; 36 pending_version_ = NULL;
34 is_shutdown_ = true; 37 is_shutdown_ = true;
35 } 38 }
36 39
37 void ServiceWorkerRegistration::ActivatePendingVersion() { 40 void ServiceWorkerRegistration::ActivatePendingVersion() {
38 active_version_->Shutdown(); 41 active_version_->Shutdown();
39 active_version_ = pending_version_; 42 active_version_ = pending_version_;
40 pending_version_ = NULL; 43 pending_version_ = NULL;
41 } 44 }
42 45
43 } // namespace content 46 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698