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

Unified Diff: content/browser/service_worker/service_worker_registration.cc

Issue 70683002: Stub out ServiceWorkerRegistration and Version classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build issues Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_registration.cc
diff --git a/content/browser/service_worker/service_worker_registration.cc b/content/browser/service_worker/service_worker_registration.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0560ca1f83f2a237d9617902cac6edbab461ce63
--- /dev/null
+++ b/content/browser/service_worker/service_worker_registration.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/service_worker/service_worker_registration.h"
+
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+
+ServiceWorkerRegistration::ServiceWorkerRegistration(const GURL& pattern,
+ const GURL& script_url,
+ int64 registration_id)
+ : pattern_(pattern),
+ script_url_(script_url),
+ registration_id_(registration_id),
+ is_shutdown_(false) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+}
+
+ServiceWorkerRegistration::~ServiceWorkerRegistration() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ Shutdown();
michaeln 2013/11/14 22:30:55 not sure this call needs to be here, if there is a
+}
+
+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
+ if (active_version_)
+ active_version_->Shutdown();
+ active_version_ = NULL;
+ if (pending_version_)
+ pending_version_->Shutdown();
+ pending_version_ = NULL;
+ is_shutdown_ = true;
+}
+
+void ServiceWorkerRegistration::ActivatePendingVersion() {
+ active_version_->Shutdown();
+ active_version_ = pending_version_;
+ pending_version_ = NULL;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698