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

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

Issue 296463005: Push API: fire push event from chrome://serviceworker-internals/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void DispatchFetchEvent(const ServiceWorkerFetchRequest& request, 167 void DispatchFetchEvent(const ServiceWorkerFetchRequest& request,
168 const FetchCallback& callback); 168 const FetchCallback& callback);
169 169
170 // Sends sync event to the associated embedded worker and asynchronously calls 170 // Sends sync event to the associated embedded worker and asynchronously calls
171 // |callback| when it errors out or it gets response from the worker to notify 171 // |callback| when it errors out or it gets response from the worker to notify
172 // completion. 172 // completion.
173 // 173 //
174 // This must be called when the status() is ACTIVE. 174 // This must be called when the status() is ACTIVE.
175 void DispatchSyncEvent(const StatusCallback& callback); 175 void DispatchSyncEvent(const StatusCallback& callback);
176 176
177 // Sends push event to the associated embedded worker and asynchronously calls
178 // |callback| when it errors out or it gets response from the worker to notify
179 // completion.
180 //
181 // This must be called when the status() is ACTIVE.
182 void DispatchPushEvent(const StatusCallback& callback);
183
177 // These are expected to be called when a renderer process host for the 184 // These are expected to be called when a renderer process host for the
178 // same-origin as for this ServiceWorkerVersion is created. The added 185 // same-origin as for this ServiceWorkerVersion is created. The added
179 // processes are used to run an in-renderer embedded worker. 186 // processes are used to run an in-renderer embedded worker.
180 void AddProcessToWorker(int process_id); 187 void AddProcessToWorker(int process_id);
181 void RemoveProcessFromWorker(int process_id); 188 void RemoveProcessFromWorker(int process_id);
182 189
183 // Returns true if this has at least one process to run. 190 // Returns true if this has at least one process to run.
184 bool HasProcessToRun() const; 191 bool HasProcessToRun() const;
185 192
186 // Adds and removes |provider_host| as a controllee of this ServiceWorker. 193 // Adds and removes |provider_host| as a controllee of this ServiceWorker.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Message handlers. 237 // Message handlers.
231 void OnGetClientDocuments(int request_id); 238 void OnGetClientDocuments(int request_id);
232 void OnActivateEventFinished(int request_id, 239 void OnActivateEventFinished(int request_id,
233 blink::WebServiceWorkerEventResult result); 240 blink::WebServiceWorkerEventResult result);
234 void OnInstallEventFinished(int request_id, 241 void OnInstallEventFinished(int request_id,
235 blink::WebServiceWorkerEventResult result); 242 blink::WebServiceWorkerEventResult result);
236 void OnFetchEventFinished(int request_id, 243 void OnFetchEventFinished(int request_id,
237 ServiceWorkerFetchEventResult result, 244 ServiceWorkerFetchEventResult result,
238 const ServiceWorkerResponse& response); 245 const ServiceWorkerResponse& response);
239 void OnSyncEventFinished(int request_id); 246 void OnSyncEventFinished(int request_id);
247 void OnPushEventFinished(int request_id);
240 void OnPostMessageToDocument(int client_id, 248 void OnPostMessageToDocument(int client_id,
241 const base::string16& message, 249 const base::string16& message,
242 const std::vector<int>& sent_message_port_ids); 250 const std::vector<int>& sent_message_port_ids);
243 251
244 void ScheduleStopWorker(); 252 void ScheduleStopWorker();
245 253
246 const int64 version_id_; 254 const int64 version_id_;
247 int64 registration_id_; 255 int64 registration_id_;
248 GURL script_url_; 256 GURL script_url_;
249 GURL scope_; 257 GURL scope_;
250 Status status_; 258 Status status_;
251 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; 259 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_;
252 std::vector<StatusCallback> start_callbacks_; 260 std::vector<StatusCallback> start_callbacks_;
253 std::vector<StatusCallback> stop_callbacks_; 261 std::vector<StatusCallback> stop_callbacks_;
254 std::vector<base::Closure> status_change_callbacks_; 262 std::vector<base::Closure> status_change_callbacks_;
255 263
256 // Message callbacks. 264 // Message callbacks.
257 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; 265 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_;
258 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; 266 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_;
259 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; 267 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_;
260 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_; 268 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_;
269 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_;
261 270
262 ControlleeMap controllee_map_; 271 ControlleeMap controllee_map_;
263 ControlleeByIDMap controllee_by_id_; 272 ControlleeByIDMap controllee_by_id_;
264 base::WeakPtr<ServiceWorkerContextCore> context_; 273 base::WeakPtr<ServiceWorkerContextCore> context_;
265 ObserverList<Listener> listeners_; 274 ObserverList<Listener> listeners_;
266 ServiceWorkerScriptCacheMap script_cache_map_; 275 ServiceWorkerScriptCacheMap script_cache_map_;
267 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; 276 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_;
268 277
269 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 278 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
270 279
271 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 280 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
272 }; 281 };
273 282
274 } // namespace content 283 } // namespace content
275 284
276 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 285 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698