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

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

Issue 238043002: Teach EmbeddedWorkerInstance to create a process when it needs one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle 2 places where context_ could be NULL. Created 6 years, 7 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"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void StartWorker(const StatusCallback& callback);
119 119
120 // Starts an embedded worker for this version. 120 // Starts an embedded worker for this version.
121 // |potential_process_ids| is a list of processes in which to start the
122 // worker.
123 // This returns OK (success) if the worker is already running.
124 void StartWorkerWithCandidateProcesses(
125 const std::vector<int>& potential_process_ids,
126 const StatusCallback& callback);
127
128 // Starts an embedded worker for this version.
121 // This returns OK (success) if the worker is already stopped. 129 // This returns OK (success) if the worker is already stopped.
122 void StopWorker(const StatusCallback& callback); 130 void StopWorker(const StatusCallback& callback);
123 131
124 // Sends an IPC message to the worker. 132 // Sends an IPC message to the worker.
125 // If the worker is not running this first tries to start it by 133 // If the worker is not running this first tries to start it by
126 // calling StartWorker internally. 134 // calling StartWorker internally.
127 // |callback| can be null if the sender does not need to know if the 135 // |callback| can be null if the sender does not need to know if the
128 // message is successfully sent or not. 136 // message is successfully sent or not.
129 void SendMessage(const IPC::Message& message, const StatusCallback& callback); 137 void SendMessage(const IPC::Message& message, const StatusCallback& callback);
130 138
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 213 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
206 214
207 private: 215 private:
208 typedef ServiceWorkerVersion self; 216 typedef ServiceWorkerVersion self;
209 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; 217 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap;
210 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; 218 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap;
211 friend class base::RefCounted<ServiceWorkerVersion>; 219 friend class base::RefCounted<ServiceWorkerVersion>;
212 220
213 virtual ~ServiceWorkerVersion(); 221 virtual ~ServiceWorkerVersion();
214 222
223 void RunStartWorkerCallbacksOnError(ServiceWorkerStatusCode status);
224
225 void DispatchInstallEventAfterStartWorker(int active_version_id,
226 const StatusCallback& callback);
227 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback);
228
215 // Message handlers. 229 // Message handlers.
216 void OnGetClientDocuments(int request_id); 230 void OnGetClientDocuments(int request_id);
217 void OnActivateEventFinished(int request_id, 231 void OnActivateEventFinished(int request_id,
218 blink::WebServiceWorkerEventResult result); 232 blink::WebServiceWorkerEventResult result);
219 void OnInstallEventFinished(int request_id, 233 void OnInstallEventFinished(int request_id,
220 blink::WebServiceWorkerEventResult result); 234 blink::WebServiceWorkerEventResult result);
221 void OnFetchEventFinished(int request_id, 235 void OnFetchEventFinished(int request_id,
222 ServiceWorkerFetchEventResult result, 236 ServiceWorkerFetchEventResult result,
223 const ServiceWorkerResponse& response); 237 const ServiceWorkerResponse& response);
224 void OnSyncEventFinished(int request_id); 238 void OnSyncEventFinished(int request_id);
(...skipping 20 matching lines...) Expand all
245 ObserverList<Listener> listeners_; 259 ObserverList<Listener> listeners_;
246 260
247 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 261 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
248 262
249 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 263 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
250 }; 264 };
251 265
252 } // namespace content 266 } // namespace content
253 267
254 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 268 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698