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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 void SetDevToolsAttached(bool attached); | 291 void SetDevToolsAttached(bool attached); |
292 | 292 |
293 // Sets the HttpResponseInfo used to load the main script. | 293 // Sets the HttpResponseInfo used to load the main script. |
294 // This HttpResponseInfo will be used for all responses sent back from the | 294 // This HttpResponseInfo will be used for all responses sent back from the |
295 // service worker, as the effective security of these responses is equivalent | 295 // service worker, as the effective security of these responses is equivalent |
296 // to that of the ServiceWorker. | 296 // to that of the ServiceWorker. |
297 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); | 297 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); |
298 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); | 298 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); |
299 | 299 |
300 private: | 300 private: |
301 class GetClientDocumentsCallback; | |
302 | |
303 friend class base::RefCounted<ServiceWorkerVersion>; | 301 friend class base::RefCounted<ServiceWorkerVersion>; |
304 friend class ServiceWorkerURLRequestJobTest; | 302 friend class ServiceWorkerURLRequestJobTest; |
305 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 303 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
306 ActivateWaitingVersion); | 304 ActivateWaitingVersion); |
307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 305 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
308 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); | 306 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); |
309 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
310 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); | 308 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); |
311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 309 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
312 TimeoutStartingWorker); | 310 TimeoutStartingWorker); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 void OnSkipWaiting(int request_id); | 380 void OnSkipWaiting(int request_id); |
383 void OnClaimClients(int request_id); | 381 void OnClaimClients(int request_id); |
384 void OnPongFromWorker(); | 382 void OnPongFromWorker(); |
385 | 383 |
386 void OnFocusClientFinished(int request_id, | 384 void OnFocusClientFinished(int request_id, |
387 int client_id, | 385 int client_id, |
388 const ServiceWorkerClientInfo& client); | 386 const ServiceWorkerClientInfo& client); |
389 | 387 |
390 void DidSkipWaiting(int request_id); | 388 void DidSkipWaiting(int request_id); |
391 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); | 389 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); |
392 void DidGetClientInfo(int client_id, | 390 void DidGetClientDocuments( |
393 scoped_refptr<GetClientDocumentsCallback> callback, | 391 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); |
394 const ServiceWorkerClientInfo& info); | |
395 | 392 |
396 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker | 393 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker |
397 // if it is excessively idle or unresponsive to ping. | 394 // if it is excessively idle or unresponsive to ping. |
398 void StartTimeoutTimer(); | 395 void StartTimeoutTimer(); |
399 void StopTimeoutTimer(); | 396 void StopTimeoutTimer(); |
400 void OnTimeoutTimer(); | 397 void OnTimeoutTimer(); |
401 | 398 |
402 // The ping protocol is for terminating workers that are taking excessively | 399 // The ping protocol is for terminating workers that are taking excessively |
403 // long executing JavaScript (e.g., stuck in while(true) {}). Periodically a | 400 // long executing JavaScript (e.g., stuck in while(true) {}). Periodically a |
404 // ping IPC is sent to the worker context and if we timeout waiting for a | 401 // ping IPC is sent to the worker context and if we timeout waiting for a |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 475 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
479 | 476 |
480 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 477 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
481 | 478 |
482 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 479 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
483 }; | 480 }; |
484 | 481 |
485 } // namespace content | 482 } // namespace content |
486 | 483 |
487 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 484 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |