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

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 182383008: Create chrome://serviceworker-internals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to ToT Created 6 years, 9 months 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/id_map.h" 13 #include "base/id_map.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "content/browser/service_worker/embedded_worker_instance.h" 16 #include "content/browser/service_worker/embedded_worker_instance.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/service_worker/service_worker_status_code.h" 18 #include "content/common/service_worker/service_worker_status_code.h"
19 #include "content/common/service_worker/service_worker_types.h" 19 #include "content/common/service_worker/service_worker_types.h"
20 20
21 class GURL; 21 class GURL;
22 22
23 namespace content { 23 namespace content {
24 24
25 class EmbeddedWorkerRegistry; 25 class EmbeddedWorkerRegistry;
26 class ServiceWorkerRegistration; 26 class ServiceWorkerRegistration;
27 class ServiceWorkerVersionInfo;
27 28
28 // This class corresponds to a specific version of a ServiceWorker 29 // This class corresponds to a specific version of a ServiceWorker
29 // script for a given pattern. When a script is upgraded, there may be 30 // script for a given pattern. When a script is upgraded, there may be
30 // more than one ServiceWorkerVersion "running" at a time, but only 31 // more than one ServiceWorkerVersion "running" at a time, but only
31 // one of them is active. This class connects the actual script with a 32 // one of them is active. This class connects the actual script with a
32 // running worker. 33 // running worker.
33 // 34 //
34 // is_shutdown_ detects the live-ness of the object itself. If the object is 35 // is_shutdown_ detects the live-ness of the object itself. If the object is
35 // shut down, then it is in the process of being deleted from memory. 36 // shut down, then it is in the process of being deleted from memory.
36 // This happens when a version is replaced as well as at browser shutdown. 37 // This happens when a version is replaced as well as at browser shutdown.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 75
75 int64 version_id() const { return version_id_; } 76 int64 version_id() const { return version_id_; }
76 77
77 void Shutdown(); 78 void Shutdown();
78 bool is_shutdown() const { return is_shutdown_; } 79 bool is_shutdown() const { return is_shutdown_; }
79 80
80 RunningStatus running_status() const { 81 RunningStatus running_status() const {
81 return static_cast<RunningStatus>(embedded_worker_->status()); 82 return static_cast<RunningStatus>(embedded_worker_->status());
82 } 83 }
83 84
85 ServiceWorkerVersionInfo GetInfo();
86
84 Status status() const { return status_; } 87 Status status() const { return status_; }
85 void set_status(Status status) { status_ = status; } 88 void set_status(Status status) { status_ = status; }
86 89
87 // Starts an embedded worker for this version. 90 // Starts an embedded worker for this version.
88 // This returns OK (success) if the worker is already running. 91 // This returns OK (success) if the worker is already running.
89 void StartWorker(const StatusCallback& callback); 92 void StartWorker(const StatusCallback& callback);
90 93
91 // Starts an embedded worker for this version. 94 // Starts an embedded worker for this version.
92 // This returns OK (success) if the worker is already stopped. 95 // This returns OK (success) if the worker is already stopped.
93 void StopWorker(const StatusCallback& callback); 96 void StopWorker(const StatusCallback& callback);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_; 167 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_;
165 168
166 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 169 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
167 170
168 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 171 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
169 }; 172 };
170 173
171 } // namespace content 174 } // namespace content
172 175
173 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 176 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | content/browser/service_worker/service_worker_version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698