Cast: Skip receiver log messages with time delta that can't be encoded.
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_registration.cc
blobe3a7e9597b40c9bddd14ccff7280eefea8818033
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
3 // found in the LICENSE file.
5 #include "content/browser/service_worker/service_worker_registration.h"
7 #include "content/public/browser/browser_thread.h"
9 namespace content {
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 next_version_id_(0L),
18 is_shutdown_(false) {
19 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
22 ServiceWorkerRegistration::~ServiceWorkerRegistration() {
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
24 DCHECK(is_shutdown_);
27 void ServiceWorkerRegistration::Shutdown() {
28 DCHECK(!is_shutdown_);
29 if (active_version_)
30 active_version_->Shutdown();
31 active_version_ = NULL;
32 if (pending_version_)
33 pending_version_->Shutdown();
34 pending_version_ = NULL;
35 is_shutdown_ = true;
38 void ServiceWorkerRegistration::ActivatePendingVersion() {
39 active_version_->Shutdown();
40 active_version_ = pending_version_;
41 pending_version_ = NULL;
44 } // namespace content