| 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 <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 ACTIVATING, // Activate event is dispatched and being handled. | 88 ACTIVATING, // Activate event is dispatched and being handled. |
| 89 ACTIVATED, // Activation is finished and can run as activated. | 89 ACTIVATED, // Activation is finished and can run as activated. |
| 90 REDUNDANT, // The version is no longer running as activated, due to | 90 REDUNDANT, // The version is no longer running as activated, due to |
| 91 // unregistration or replace. | 91 // unregistration or replace. |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 class Listener { | 94 class Listener { |
| 95 public: | 95 public: |
| 96 virtual void OnRunningStateChanged(ServiceWorkerVersion* version) {} | 96 virtual void OnRunningStateChanged(ServiceWorkerVersion* version) {} |
| 97 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) {} | 97 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) {} |
| 98 virtual void OnVersionUpdateTimeSet(ServiceWorkerVersion* version) {} |
| 98 virtual void OnErrorReported(ServiceWorkerVersion* version, | 99 virtual void OnErrorReported(ServiceWorkerVersion* version, |
| 99 const base::string16& error_message, | 100 const base::string16& error_message, |
| 100 int line_number, | 101 int line_number, |
| 101 int column_number, | 102 int column_number, |
| 102 const GURL& source_url) {} | 103 const GURL& source_url) {} |
| 103 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, | 104 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, |
| 104 int source_identifier, | 105 int source_identifier, |
| 105 int message_level, | 106 int message_level, |
| 106 const base::string16& message, | 107 const base::string16& message, |
| 107 int line_number, | 108 int line_number, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 295 |
| 295 void SetDevToolsAttached(bool attached); | 296 void SetDevToolsAttached(bool attached); |
| 296 | 297 |
| 297 // Sets the HttpResponseInfo used to load the main script. | 298 // Sets the HttpResponseInfo used to load the main script. |
| 298 // 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 |
| 299 // service worker, as the effective security of these responses is equivalent | 300 // service worker, as the effective security of these responses is equivalent |
| 300 // to that of the ServiceWorker. | 301 // to that of the ServiceWorker. |
| 301 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); | 302 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); |
| 302 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); | 303 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); |
| 303 | 304 |
| 305 base::Time update_time() const { return update_time_; } |
| 306 void set_update_time(base::Time update_time); |
| 307 |
| 304 private: | 308 private: |
| 305 friend class base::RefCounted<ServiceWorkerVersion>; | 309 friend class base::RefCounted<ServiceWorkerVersion>; |
| 306 friend class ServiceWorkerURLRequestJobTest; | 310 friend class ServiceWorkerURLRequestJobTest; |
| 307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
| 308 ActivateWaitingVersion); | 312 ActivateWaitingVersion); |
| 309 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, IdleTimeout); | 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, IdleTimeout); |
| 310 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); | 314 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); |
| 311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 315 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
| 312 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, SetDevToolsAttached); | 316 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, SetDevToolsAttached); |
| 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWaitForeverInFetchTest, RequestTimeout); | 317 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWaitForeverInFetchTest, RequestTimeout); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 RequestType request_type); | 465 RequestType request_type); |
| 462 | 466 |
| 463 bool OnRequestTimeout(const RequestInfo& info); | 467 bool OnRequestTimeout(const RequestInfo& info); |
| 464 void SetAllRequestTimes(const base::TimeTicks& ticks); | 468 void SetAllRequestTimes(const base::TimeTicks& ticks); |
| 465 | 469 |
| 466 const int64 version_id_; | 470 const int64 version_id_; |
| 467 int64 registration_id_; | 471 int64 registration_id_; |
| 468 GURL script_url_; | 472 GURL script_url_; |
| 469 GURL scope_; | 473 GURL scope_; |
| 470 Status status_; | 474 Status status_; |
| 475 base::Time update_time_; |
| 471 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 476 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
| 472 std::vector<StatusCallback> start_callbacks_; | 477 std::vector<StatusCallback> start_callbacks_; |
| 473 std::vector<StatusCallback> stop_callbacks_; | 478 std::vector<StatusCallback> stop_callbacks_; |
| 474 std::vector<base::Closure> status_change_callbacks_; | 479 std::vector<base::Closure> status_change_callbacks_; |
| 475 | 480 |
| 476 // Message callbacks. (Update HasInflightRequests() too when you update this | 481 // Message callbacks. (Update HasInflightRequests() too when you update this |
| 477 // list.) | 482 // list.) |
| 478 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; | 483 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; |
| 479 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; | 484 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; |
| 480 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; | 485 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 524 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
| 520 | 525 |
| 521 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 526 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 522 | 527 |
| 523 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 528 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 524 }; | 529 }; |
| 525 | 530 |
| 526 } // namespace content | 531 } // namespace content |
| 527 | 532 |
| 528 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 533 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |