| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 void SetDevToolsAttached(bool attached); | 296 void SetDevToolsAttached(bool attached); |
| 297 | 297 |
| 298 // Sets the HttpResponseInfo used to load the main script. | 298 // Sets the HttpResponseInfo used to load the main script. |
| 299 // This HttpResponseInfo will be used for all responses sent back from the | 299 // This HttpResponseInfo will be used for all responses sent back from the |
| 300 // service worker, as the effective security of these responses is equivalent | 300 // service worker, as the effective security of these responses is equivalent |
| 301 // to that of the ServiceWorker. | 301 // to that of the ServiceWorker. |
| 302 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); | 302 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); |
| 303 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); | 303 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); |
| 304 | 304 |
| 305 private: | 305 private: |
| 306 class GetClientDocumentsCallback; | 306 class GetClientsCallback; |
| 307 | 307 |
| 308 friend class base::RefCounted<ServiceWorkerVersion>; | 308 friend class base::RefCounted<ServiceWorkerVersion>; |
| 309 friend class ServiceWorkerURLRequestJobTest; | 309 friend class ServiceWorkerURLRequestJobTest; |
| 310 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 310 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
| 311 ActivateWaitingVersion); | 311 ActivateWaitingVersion); |
| 312 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 312 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
| 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); | 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); |
| 314 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 314 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
| 315 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 315 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
| 316 TimeoutStartingWorker); | 316 TimeoutStartingWorker); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 344 void DispatchInstallEventAfterStartWorker(int active_version_id, | 344 void DispatchInstallEventAfterStartWorker(int active_version_id, |
| 345 const StatusCallback& callback); | 345 const StatusCallback& callback); |
| 346 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); | 346 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); |
| 347 | 347 |
| 348 void DispatchMessageEventInternal( | 348 void DispatchMessageEventInternal( |
| 349 const base::string16& message, | 349 const base::string16& message, |
| 350 const std::vector<TransferredMessagePort>& sent_message_ports, | 350 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 351 const StatusCallback& callback); | 351 const StatusCallback& callback); |
| 352 | 352 |
| 353 // Message handlers. | 353 // Message handlers. |
| 354 void OnGetClientDocuments(int request_id); | 354 void OnGetClients(int request_id, |
| 355 const ServiceWorkerClientQueryOptions& options); |
| 355 void OnActivateEventFinished(int request_id, | 356 void OnActivateEventFinished(int request_id, |
| 356 blink::WebServiceWorkerEventResult result); | 357 blink::WebServiceWorkerEventResult result); |
| 357 void OnInstallEventFinished(int request_id, | 358 void OnInstallEventFinished(int request_id, |
| 358 blink::WebServiceWorkerEventResult result); | 359 blink::WebServiceWorkerEventResult result); |
| 359 void OnFetchEventFinished(int request_id, | 360 void OnFetchEventFinished(int request_id, |
| 360 ServiceWorkerFetchEventResult result, | 361 ServiceWorkerFetchEventResult result, |
| 361 const ServiceWorkerResponse& response); | 362 const ServiceWorkerResponse& response); |
| 362 void OnSyncEventFinished(int request_id); | 363 void OnSyncEventFinished(int request_id); |
| 363 void OnNotificationClickEventFinished(int request_id); | 364 void OnNotificationClickEventFinished(int request_id); |
| 364 void OnPushEventFinished(int request_id, | 365 void OnPushEventFinished(int request_id, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 388 void OnClaimClients(int request_id); | 389 void OnClaimClients(int request_id); |
| 389 void OnPongFromWorker(); | 390 void OnPongFromWorker(); |
| 390 | 391 |
| 391 void OnFocusClientFinished(int request_id, | 392 void OnFocusClientFinished(int request_id, |
| 392 int client_id, | 393 int client_id, |
| 393 const ServiceWorkerClientInfo& client); | 394 const ServiceWorkerClientInfo& client); |
| 394 | 395 |
| 395 void DidSkipWaiting(int request_id); | 396 void DidSkipWaiting(int request_id); |
| 396 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); | 397 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); |
| 397 void DidGetClientInfo(int client_id, | 398 void DidGetClientInfo(int client_id, |
| 398 scoped_refptr<GetClientDocumentsCallback> callback, | 399 scoped_refptr<GetClientsCallback> callback, |
| 399 const ServiceWorkerClientInfo& info); | 400 const ServiceWorkerClientInfo& info); |
| 400 | 401 |
| 401 // The ping protocol is for terminating workers that are taking excessively | 402 // The ping protocol is for terminating workers that are taking excessively |
| 402 // long executing JavaScript (e.g., stuck in while(true) {}). Periodically a | 403 // long executing JavaScript (e.g., stuck in while(true) {}). Periodically a |
| 403 // ping IPC is sent to the worker context and if we timeout waiting for a | 404 // ping IPC is sent to the worker context and if we timeout waiting for a |
| 404 // pong, the worker is terminated. | 405 // pong, the worker is terminated. |
| 405 void PingWorker(); | 406 void PingWorker(); |
| 406 void StartPingWorker(); | 407 void StartPingWorker(); |
| 407 void SchedulePingWorker(); | 408 void SchedulePingWorker(); |
| 408 void OnPingTimeout(); | 409 void OnPingTimeout(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 461 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
| 461 | 462 |
| 462 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 463 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 463 | 464 |
| 464 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 465 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 465 }; | 466 }; |
| 466 | 467 |
| 467 } // namespace content | 468 } // namespace content |
| 468 | 469 |
| 469 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 470 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |