OLD | NEW |
---|---|
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" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 // if there're any (see RegisterStatusChangeCallback). | 108 // if there're any (see RegisterStatusChangeCallback). |
109 void SetStatus(Status status); | 109 void SetStatus(Status status); |
110 | 110 |
111 // Registers status change callback. (This is for one-off observation, | 111 // Registers status change callback. (This is for one-off observation, |
112 // the consumer needs to re-register if it wants to continue observing | 112 // the consumer needs to re-register if it wants to continue observing |
113 // status changes) | 113 // status changes) |
114 void RegisterStatusChangeCallback(const base::Closure& callback); | 114 void RegisterStatusChangeCallback(const base::Closure& callback); |
115 | 115 |
116 // Starts an embedded worker for this version. | 116 // Starts an embedded worker for this version. |
117 // This returns OK (success) if the worker is already running. | 117 // This returns OK (success) if the worker is already running. |
118 void StartWorker(const StatusCallback& callback); | 118 // |potential_process_ids| is a list of processes in which to start the |
119 // worker. | |
120 void StartWorker( | |
121 const StatusCallback& callback, | |
122 const std::vector<int>& potential_process_ids = std::vector<int>()); | |
kinuko
2014/04/28 06:58:16
Again, no optional parameters in chromium... Coul
Jeffrey Yasskin
2014/04/28 20:47:40
Sure, done.
| |
119 | 123 |
120 // Starts an embedded worker for this version. | 124 // Starts an embedded worker for this version. |
121 // This returns OK (success) if the worker is already stopped. | 125 // This returns OK (success) if the worker is already stopped. |
122 void StopWorker(const StatusCallback& callback); | 126 void StopWorker(const StatusCallback& callback); |
123 | 127 |
124 // Sends an IPC message to the worker. | 128 // Sends an IPC message to the worker. |
125 // If the worker is not running this first tries to start it by | 129 // If the worker is not running this first tries to start it by |
126 // calling StartWorker internally. | 130 // calling StartWorker internally. |
127 // |callback| can be null if the sender does not need to know if the | 131 // |callback| can be null if the sender does not need to know if the |
128 // message is successfully sent or not. | 132 // message is successfully sent or not. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 209 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
206 | 210 |
207 private: | 211 private: |
208 typedef ServiceWorkerVersion self; | 212 typedef ServiceWorkerVersion self; |
209 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; | 213 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; |
210 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; | 214 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; |
211 friend class base::RefCounted<ServiceWorkerVersion>; | 215 friend class base::RefCounted<ServiceWorkerVersion>; |
212 | 216 |
213 virtual ~ServiceWorkerVersion(); | 217 virtual ~ServiceWorkerVersion(); |
214 | 218 |
219 void RunStartWorkerCallbacksOnError(ServiceWorkerStatusCode status); | |
220 | |
221 void DispatchInstallEventAfterStartWorker(int active_version_id, | |
222 const StatusCallback& callback); | |
223 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); | |
224 | |
215 // Message handlers. | 225 // Message handlers. |
216 void OnGetClientDocuments(int request_id); | 226 void OnGetClientDocuments(int request_id); |
217 void OnActivateEventFinished(int request_id, | 227 void OnActivateEventFinished(int request_id, |
218 blink::WebServiceWorkerEventResult result); | 228 blink::WebServiceWorkerEventResult result); |
219 void OnInstallEventFinished(int request_id, | 229 void OnInstallEventFinished(int request_id, |
220 blink::WebServiceWorkerEventResult result); | 230 blink::WebServiceWorkerEventResult result); |
221 void OnFetchEventFinished(int request_id, | 231 void OnFetchEventFinished(int request_id, |
222 ServiceWorkerFetchEventResult result, | 232 ServiceWorkerFetchEventResult result, |
223 const ServiceWorkerResponse& response); | 233 const ServiceWorkerResponse& response); |
224 void OnSyncEventFinished(int request_id); | 234 void OnSyncEventFinished(int request_id); |
(...skipping 20 matching lines...) Expand all Loading... | |
245 ObserverList<Listener> listeners_; | 255 ObserverList<Listener> listeners_; |
246 | 256 |
247 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 257 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
248 | 258 |
249 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 259 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
250 }; | 260 }; |
251 | 261 |
252 } // namespace content | 262 } // namespace content |
253 | 263 |
254 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 264 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |