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

Side by Side 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: Switch all parameters to raw pointers 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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.
24 // Instances of this class are in one of two install states:
25 // - Pending: The script is in the process of being installed. There
26 // may be another active script running.
27 // - Active: The script is the only worker handling requests for the
28 // registration's pattern.
29 //
30 // In addition, a version has a running state (this is a rough
31 // sketch). Since a service worker can be stopped and started at any
32 // time, it will transition among these states multiple times during
33 // its lifetime.
34 // - Stopped: The script is not running
35 // - Starting: A request to fire an event against the version has been
36 // queued, but the worker is not yet
37 // loaded/initialized/etc.
38 // - Started: The worker is ready to receive events
39 // - Stopping: The worker is returning to the stopped state.
40 //
41 // The worker can "run" in both the Pending and the Active
42 // install states above. During the Pending state, the worker is only
43 // started in order to fire the 'install' and 'activate'
44 // events. During the Active state, it can receive other events such
45 // as 'fetch'.
46 //
47 // And finally, is_shutdown_ is detects the live-ness of the object
48 // itself. If the object is shut down, then it is in the process of
49 // being deleted from memory. This happens when a version is replaced
50 // as well as at browser shutdown.
51 class CONTENT_EXPORT ServiceWorkerVersion
kinuko 2013/11/18 02:18:24 nit: Do we really need to export all these classes
alecflett 2013/11/18 17:50:08 Yep, in order to write unit tests..I feel like CON
52 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>) {
53 public:
54 explicit ServiceWorkerVersion(ServiceWorkerRegistration* registration);
55
56 void Shutdown();
57 bool is_shutdown() const { return is_shutdown_; }
58
59 private:
60 ~ServiceWorkerVersion();
61 friend class base::RefCounted<ServiceWorkerVersion>;
kinuko 2013/11/18 02:18:24 style-nit: can you move this line right after priv
alecflett 2013/11/18 17:50:08 Sure, I'll take care of this in the next patch, ho
62
63 bool is_shutdown_;
64 scoped_refptr<ServiceWorkerRegistration> registration_;
65
66 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
67 };
68 } // namespace content
69 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698