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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/gtest_prod_util.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "content/common/content_export.h" | |
12 | |
13 class GURL; | |
14 | |
15 namespace content { | |
16 | |
17 class ServiceWorkerRegistration; | |
18 | |
19 // This class corresponds to a specific version of a ServiceWorker | |
20 // script for a given pattern. When a script is upgraded, there may be | |
21 // more than one ServiceWorkerVersion "running" at a time, but only | |
22 // one of them is active. This class connects the actual script with a | |
23 // running worker. Instances of this class are in one of three states: | |
24 // - Pending: The script is in the process of being installed. There | |
25 // may be another active script running. | |
26 // - Active: The script is the only worker handling requests for the | |
27 // registration's pattern. | |
28 // - Shutdown: This script version is no longer active and is likely | |
29 // in the process of cleaning itself up. This happens when | |
30 // a script is upgraded to a new ServiceWorkerVersion, or | |
31 // 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
| |
32 class CONTENT_EXPORT ServiceWorkerVersion | |
33 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>) { | |
34 public: | |
35 explicit ServiceWorkerVersion( | |
36 scoped_refptr<ServiceWorkerRegistration> registration); | |
37 | |
38 void Shutdown(); | |
39 bool is_shutdown() const { return is_shutdown_; } | |
40 | |
41 private: | |
42 ~ServiceWorkerVersion(); | |
43 friend class base::RefCounted<ServiceWorkerVersion>; | |
44 | |
45 bool is_shutdown_; | |
46 scoped_refptr<ServiceWorkerRegistration> registration_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | |
49 }; | |
50 } // namespace content | |
51 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | |
OLD | NEW |