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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); | 306 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); |
307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
308 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); | 308 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); |
309 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 309 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
310 TimeoutStartingWorker); | 310 TimeoutStartingWorker); |
311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
312 TimeoutWorkerInEvent); | 312 TimeoutWorkerInEvent); |
313 friend class ServiceWorkerVersionBrowserTest; | 313 friend class ServiceWorkerVersionBrowserTest; |
314 | 314 |
315 typedef ServiceWorkerVersion self; | 315 typedef ServiceWorkerVersion self; |
316 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; | |
317 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; | |
318 | 316 |
319 ~ServiceWorkerVersion() override; | 317 ~ServiceWorkerVersion() override; |
320 | 318 |
321 // EmbeddedWorkerInstance::Listener overrides: | 319 // EmbeddedWorkerInstance::Listener overrides: |
322 void OnScriptLoaded() override; | 320 void OnScriptLoaded() override; |
323 void OnStarted() override; | 321 void OnStarted() override; |
324 void OnStopped(EmbeddedWorkerInstance::Status old_status) override; | 322 void OnStopped(EmbeddedWorkerInstance::Status old_status) override; |
325 void OnReportException(const base::string16& error_message, | 323 void OnReportException(const base::string16& error_message, |
326 int line_number, | 324 int line_number, |
327 int column_number, | 325 int column_number, |
(...skipping 30 matching lines...) Expand all Loading... |
358 void OnPushEventFinished(int request_id, | 356 void OnPushEventFinished(int request_id, |
359 blink::WebServiceWorkerEventResult result); | 357 blink::WebServiceWorkerEventResult result); |
360 void OnGeofencingEventFinished(int request_id); | 358 void OnGeofencingEventFinished(int request_id); |
361 void OnCrossOriginConnectEventFinished(int request_id, | 359 void OnCrossOriginConnectEventFinished(int request_id, |
362 bool accept_connection); | 360 bool accept_connection); |
363 void OnOpenWindow(int request_id, const GURL& url); | 361 void OnOpenWindow(int request_id, const GURL& url); |
364 void DidOpenWindow(int request_id, | 362 void DidOpenWindow(int request_id, |
365 int render_process_id, | 363 int render_process_id, |
366 int render_frame_id); | 364 int render_frame_id); |
367 void OnOpenWindowFinished(int request_id, | 365 void OnOpenWindowFinished(int request_id, |
368 int client_id, | 366 const std::string& client_uuid, |
369 const ServiceWorkerClientInfo& client_info); | 367 const ServiceWorkerClientInfo& client_info); |
370 | 368 |
371 void OnSetCachedMetadata(const GURL& url, const std::vector<char>& data); | 369 void OnSetCachedMetadata(const GURL& url, const std::vector<char>& data); |
372 void OnSetCachedMetadataFinished(int64 callback_id, int result); | 370 void OnSetCachedMetadataFinished(int64 callback_id, int result); |
373 void OnClearCachedMetadata(const GURL& url); | 371 void OnClearCachedMetadata(const GURL& url); |
374 void OnClearCachedMetadataFinished(int64 callback_id, int result); | 372 void OnClearCachedMetadataFinished(int64 callback_id, int result); |
375 | 373 |
376 void OnPostMessageToDocument( | 374 void OnPostMessageToClient( |
377 int client_id, | 375 const std::string& client_uuid, |
378 const base::string16& message, | 376 const base::string16& message, |
379 const std::vector<TransferredMessagePort>& sent_message_ports); | 377 const std::vector<TransferredMessagePort>& sent_message_ports); |
380 void OnFocusClient(int request_id, int client_id); | 378 void OnFocusClient(int request_id, const std::string& client_uuid); |
381 void OnSkipWaiting(int request_id); | 379 void OnSkipWaiting(int request_id); |
382 void OnClaimClients(int request_id); | 380 void OnClaimClients(int request_id); |
383 void OnPongFromWorker(); | 381 void OnPongFromWorker(); |
384 | 382 |
385 void OnFocusClientFinished(int request_id, | 383 void OnFocusClientFinished(int request_id, |
386 int client_id, | 384 const std::string& client_uuid, |
387 const ServiceWorkerClientInfo& client); | 385 const ServiceWorkerClientInfo& client); |
388 | 386 |
389 void DidSkipWaiting(int request_id); | 387 void DidSkipWaiting(int request_id); |
390 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); | 388 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); |
391 void DidGetClients( | 389 void DidGetClients( |
392 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); | 390 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); |
393 | 391 |
394 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker | 392 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker |
395 // if it is excessively idle or unresponsive to ping. | 393 // if it is excessively idle or unresponsive to ping. |
396 void StartTimeoutTimer(); | 394 void StartTimeoutTimer(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; | 439 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; |
442 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_; | 440 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_; |
443 IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_; | 441 IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_; |
444 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_; | 442 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_; |
445 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; | 443 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; |
446 IDMap<CrossOriginConnectCallback, IDMapOwnPointer> | 444 IDMap<CrossOriginConnectCallback, IDMapOwnPointer> |
447 cross_origin_connect_callbacks_; | 445 cross_origin_connect_callbacks_; |
448 | 446 |
449 std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; | 447 std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; |
450 | 448 |
451 ControlleeMap controllee_map_; | 449 std::map<std::string, ServiceWorkerProviderHost*> controllee_map_; |
452 ControlleeByIDMap controllee_by_id_; | |
453 // Will be null while shutting down. | 450 // Will be null while shutting down. |
454 base::WeakPtr<ServiceWorkerContextCore> context_; | 451 base::WeakPtr<ServiceWorkerContextCore> context_; |
455 ObserverList<Listener> listeners_; | 452 ObserverList<Listener> listeners_; |
456 ServiceWorkerScriptCacheMap script_cache_map_; | 453 ServiceWorkerScriptCacheMap script_cache_map_; |
457 base::OneShotTimer<ServiceWorkerVersion> update_timer_; | 454 base::OneShotTimer<ServiceWorkerVersion> update_timer_; |
458 | 455 |
459 // Starts running when the script is loaded (which means it is about to begin | 456 // Starts running when the script is loaded (which means it is about to begin |
460 // evaluation) and continues until the worker is stopped or a stop request is | 457 // evaluation) and continues until the worker is stopped or a stop request is |
461 // ignored because DevTools is attached. | 458 // ignored because DevTools is attached. |
462 base::RepeatingTimer<ServiceWorkerVersion> timeout_timer_; | 459 base::RepeatingTimer<ServiceWorkerVersion> timeout_timer_; |
(...skipping 13 matching lines...) Expand all Loading... |
476 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 473 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
477 | 474 |
478 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 475 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
479 | 476 |
480 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 477 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
481 }; | 478 }; |
482 | 479 |
483 } // namespace content | 480 } // namespace content |
484 | 481 |
485 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 482 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |