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

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

Issue 893783002: Revert of Gather the ServiceWorker client information in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_getvisibilitystate
Patch Set: Created 5 years, 10 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 <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 18 matching lines...) Expand all
29 29
30 class GURL; 30 class GURL;
31 31
32 namespace blink { 32 namespace blink {
33 struct WebCircularGeofencingRegion; 33 struct WebCircularGeofencingRegion;
34 } 34 }
35 35
36 namespace content { 36 namespace content {
37 37
38 class EmbeddedWorkerRegistry; 38 class EmbeddedWorkerRegistry;
39 struct NavigatorConnectClient;
40 struct PlatformNotificationData;
39 class ServiceWorkerContextCore; 41 class ServiceWorkerContextCore;
40 class ServiceWorkerProviderHost; 42 class ServiceWorkerProviderHost;
41 class ServiceWorkerRegistration; 43 class ServiceWorkerRegistration;
42 class ServiceWorkerURLRequestJob; 44 class ServiceWorkerURLRequestJob;
43 class ServiceWorkerVersionInfo; 45 class ServiceWorkerVersionInfo;
44 struct NavigatorConnectClient;
45 struct PlatformNotificationData;
46 struct ServiceWorkerClientInfo;
47 46
48 // This class corresponds to a specific version of a ServiceWorker 47 // This class corresponds to a specific version of a ServiceWorker
49 // script for a given pattern. When a script is upgraded, there may be 48 // script for a given pattern. When a script is upgraded, there may be
50 // more than one ServiceWorkerVersion "running" at a time, but only 49 // more than one ServiceWorkerVersion "running" at a time, but only
51 // one of them is activated. This class connects the actual script with a 50 // one of them is activated. This class connects the actual script with a
52 // running worker. 51 // running worker.
53 class CONTENT_EXPORT ServiceWorkerVersion 52 class CONTENT_EXPORT ServiceWorkerVersion
54 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>), 53 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>),
55 public EmbeddedWorkerInstance::Listener { 54 public EmbeddedWorkerInstance::Listener {
56 public: 55 public:
57 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback; 56 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback;
58 typedef base::Callback<void(ServiceWorkerStatusCode, 57 typedef base::Callback<void(ServiceWorkerStatusCode,
59 const IPC::Message& message)> MessageCallback; 58 const IPC::Message& message)> MessageCallback;
60 typedef base::Callback<void(ServiceWorkerStatusCode, 59 typedef base::Callback<void(ServiceWorkerStatusCode,
61 ServiceWorkerFetchEventResult, 60 ServiceWorkerFetchEventResult,
62 const ServiceWorkerResponse&)> FetchCallback; 61 const ServiceWorkerResponse&)> FetchCallback;
62 typedef base::Callback<void(ServiceWorkerStatusCode,
63 const ServiceWorkerClientInfo&)>
64 GetClientInfoCallback;
63 typedef base::Callback<void(ServiceWorkerStatusCode, bool)> 65 typedef base::Callback<void(ServiceWorkerStatusCode, bool)>
64 CrossOriginConnectCallback; 66 CrossOriginConnectCallback;
65 67
66 enum RunningStatus { 68 enum RunningStatus {
67 STOPPED = EmbeddedWorkerInstance::STOPPED, 69 STOPPED = EmbeddedWorkerInstance::STOPPED,
68 STARTING = EmbeddedWorkerInstance::STARTING, 70 STARTING = EmbeddedWorkerInstance::STARTING,
69 RUNNING = EmbeddedWorkerInstance::RUNNING, 71 RUNNING = EmbeddedWorkerInstance::RUNNING,
70 STOPPING = EmbeddedWorkerInstance::STOPPING, 72 STOPPING = EmbeddedWorkerInstance::STOPPING,
71 }; 73 };
72 74
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 const StatusCallback& callback); 328 const StatusCallback& callback);
327 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); 329 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback);
328 330
329 void DispatchMessageEventInternal( 331 void DispatchMessageEventInternal(
330 const base::string16& message, 332 const base::string16& message,
331 const std::vector<int>& sent_message_port_ids, 333 const std::vector<int>& sent_message_port_ids,
332 const StatusCallback& callback); 334 const StatusCallback& callback);
333 335
334 // Message handlers. 336 // Message handlers.
335 void OnGetClientDocuments(int request_id); 337 void OnGetClientDocuments(int request_id);
338 void OnGetClientInfoSuccess(int request_id,
339 const ServiceWorkerClientInfo& info);
340 void OnGetClientInfoError(int request_id);
336 void OnActivateEventFinished(int request_id, 341 void OnActivateEventFinished(int request_id,
337 blink::WebServiceWorkerEventResult result); 342 blink::WebServiceWorkerEventResult result);
338 void OnInstallEventFinished(int request_id, 343 void OnInstallEventFinished(int request_id,
339 blink::WebServiceWorkerEventResult result); 344 blink::WebServiceWorkerEventResult result);
340 void OnFetchEventFinished(int request_id, 345 void OnFetchEventFinished(int request_id,
341 ServiceWorkerFetchEventResult result, 346 ServiceWorkerFetchEventResult result,
342 const ServiceWorkerResponse& response); 347 const ServiceWorkerResponse& response);
343 void OnSyncEventFinished(int request_id); 348 void OnSyncEventFinished(int request_id);
344 void OnNotificationClickEventFinished(int request_id); 349 void OnNotificationClickEventFinished(int request_id);
345 void OnPushEventFinished(int request_id, 350 void OnPushEventFinished(int request_id,
346 blink::WebServiceWorkerEventResult result); 351 blink::WebServiceWorkerEventResult result);
347 void OnGeofencingEventFinished(int request_id); 352 void OnGeofencingEventFinished(int request_id);
348 void OnCrossOriginConnectEventFinished(int request_id, 353 void OnCrossOriginConnectEventFinished(int request_id,
349 bool accept_connection); 354 bool accept_connection);
350 void OnPostMessageToDocument(int client_id, 355 void OnPostMessageToDocument(int client_id,
351 const base::string16& message, 356 const base::string16& message,
352 const std::vector<int>& sent_message_port_ids); 357 const std::vector<int>& sent_message_port_ids);
353 void OnFocusClient(int request_id, int client_id); 358 void OnFocusClient(int request_id, int client_id);
354 void OnSkipWaiting(int request_id); 359 void OnSkipWaiting(int request_id);
355 360
356 void OnFocusClientFinished(int request_id, bool result); 361 void OnFocusClientFinished(int request_id, bool result);
357 void DidSkipWaiting(int request_id); 362 void DidSkipWaiting(int request_id);
358 void DidGetClientInfo(int client_id, 363 void DidGetClientInfo(int client_id,
359 scoped_refptr<GetClientDocumentsCallback> callback, 364 scoped_refptr<GetClientDocumentsCallback> callback,
365 ServiceWorkerStatusCode status,
360 const ServiceWorkerClientInfo& info); 366 const ServiceWorkerClientInfo& info);
361 void ScheduleStopWorker(); 367 void ScheduleStopWorker();
362 void StopWorkerIfIdle(); 368 void StopWorkerIfIdle();
363 bool HasInflightRequests() const; 369 bool HasInflightRequests() const;
364 370
365 void DoomInternal(); 371 void DoomInternal();
366 372
367 template <typename IDMAP> 373 template <typename IDMAP>
368 void RemoveCallbackAndStopIfDoomed(IDMAP* callbacks, int request_id); 374 void RemoveCallbackAndStopIfDoomed(IDMAP* callbacks, int request_id);
369 375
(...skipping 10 matching lines...) Expand all
380 386
381 // Message callbacks. (Update HasInflightRequests() too when you update this 387 // Message callbacks. (Update HasInflightRequests() too when you update this
382 // list.) 388 // list.)
383 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; 389 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_;
384 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; 390 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_;
385 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; 391 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_;
386 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_; 392 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_;
387 IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_; 393 IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_;
388 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_; 394 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_;
389 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; 395 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_;
396 IDMap<GetClientInfoCallback, IDMapOwnPointer> get_client_info_callbacks_;
390 IDMap<CrossOriginConnectCallback, IDMapOwnPointer> 397 IDMap<CrossOriginConnectCallback, IDMapOwnPointer>
391 cross_origin_connect_callbacks_; 398 cross_origin_connect_callbacks_;
392 399
393 std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; 400 std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_;
394 401
395 ControlleeMap controllee_map_; 402 ControlleeMap controllee_map_;
396 ControlleeByIDMap controllee_by_id_; 403 ControlleeByIDMap controllee_by_id_;
397 base::WeakPtr<ServiceWorkerContextCore> context_; 404 base::WeakPtr<ServiceWorkerContextCore> context_;
398 ObserverList<Listener> listeners_; 405 ObserverList<Listener> listeners_;
399 ServiceWorkerScriptCacheMap script_cache_map_; 406 ServiceWorkerScriptCacheMap script_cache_map_;
400 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; 407 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_;
401 base::OneShotTimer<ServiceWorkerVersion> update_timer_; 408 base::OneShotTimer<ServiceWorkerVersion> update_timer_;
402 bool is_doomed_; 409 bool is_doomed_;
403 std::vector<int> pending_skip_waiting_requests_; 410 std::vector<int> pending_skip_waiting_requests_;
404 bool skip_waiting_; 411 bool skip_waiting_;
405 412
406 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 413 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
407 414
408 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 415 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
409 }; 416 };
410 417
411 } // namespace content 418 } // namespace content
412 419
413 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 420 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698