OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/service_worker/service_worker_registration.h" | |
6 | |
7 #include "content/public/browser/browser_thread.h" | |
8 | |
9 namespace content { | |
10 | |
11 ServiceWorkerRegistration::ServiceWorkerRegistration(const GURL& pattern, | |
12 const GURL& script_url, | |
13 int64 registration_id) | |
14 : pattern_(pattern), | |
15 script_url_(script_url), | |
16 registration_id_(registration_id), | |
17 is_shutdown_(false) { | |
18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
19 } | |
20 | |
21 ServiceWorkerRegistration::~ServiceWorkerRegistration() { | |
22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
23 Shutdown(); | |
michaeln
2013/11/14 22:30:55
not sure this call needs to be here, if there is a
| |
24 } | |
25 | |
26 void ServiceWorkerRegistration::Shutdown() { | |
michaeln
2013/11/14 22:30:55
maybe if (shutdown_) return
alecflett
2013/11/15 01:51:39
I'll DCHECK() and if we ever get into a situation
| |
27 if (active_version_) | |
28 active_version_->Shutdown(); | |
29 active_version_ = NULL; | |
30 if (pending_version_) | |
31 pending_version_->Shutdown(); | |
32 pending_version_ = NULL; | |
33 is_shutdown_ = true; | |
34 } | |
35 | |
36 void ServiceWorkerRegistration::ActivatePendingVersion() { | |
37 active_version_->Shutdown(); | |
38 active_version_ = pending_version_; | |
39 pending_version_ = NULL; | |
40 } | |
41 | |
42 } // namespace content | |
OLD | NEW |