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

Unified Diff: content/browser/service_worker/service_worker_version.h

Issue 70683002: Stub out ServiceWorkerRegistration and Version classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to ToT 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_version.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
new file mode 100644
index 0000000000000000000000000000000000000000..de0a127df79965ae7b943f6188448d36feec2d2f
--- /dev/null
+++ b/content/browser/service_worker/service_worker_version.h
@@ -0,0 +1,51 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
+
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+
+class GURL;
+
+namespace content {
+
+class ServiceWorkerRegistration;
+
+// This class corresponds to a specific version of a ServiceWorker
+// script for a given pattern. When a script is upgraded, there may be
+// more than one ServiceWorkerVersion "running" at a time, but only
+// one of them is active. This class connects the actual script with a
+// running worker. Instances of this class are in one of three states:
+// - Pending: The script is in the process of being installed. There
+// may be another active script running.
+// - Active: The script is the only worker handling requests for the
+// registration's pattern.
+// - Shutdown: This script version is no longer active and is likely
+// in the process of cleaning itself up. This happens when
+// a script is upgraded to a new ServiceWorkerVersion, or
+// during unregistration.
michaeln 2013/11/14 00:27:33 This is a helpful comment. I think there's some bl
alecflett 2013/11/14 18:35:46 Yeah this is a good breakdown. I'll clean up this
+class CONTENT_EXPORT ServiceWorkerVersion
+ : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>) {
+ public:
+ explicit ServiceWorkerVersion(
+ scoped_refptr<ServiceWorkerRegistration> registration);
+
+ void Shutdown();
+ bool is_shutdown() const { return is_shutdown_; }
+
+ private:
+ ~ServiceWorkerVersion();
+ friend class base::RefCounted<ServiceWorkerVersion>;
+
+ bool is_shutdown_;
+ scoped_refptr<ServiceWorkerRegistration> registration_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
+};
+} // namespace content
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_

Powered by Google App Engine
This is Rietveld 408576698