| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CONTEXT_WATCHER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/containers/scoped_ptr_hash_map.h" | 13 #include "base/containers/scoped_ptr_hash_map.h" |
| 14 #include "content/browser/service_worker/service_worker_context_observer.h" | 14 #include "content/browser/service_worker/service_worker_context_observer.h" |
| 15 #include "content/browser/service_worker/service_worker_info.h" | 15 #include "content/browser/service_worker/service_worker_info.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class ServiceWorkerContextWrapper; | 19 class ServiceWorkerContextWrapper; |
| 20 enum class EmbeddedWorkerStatus; |
| 20 | 21 |
| 21 // Used to monitor the status change of the ServiceWorker registrations and | 22 // Used to monitor the status change of the ServiceWorker registrations and |
| 22 // versions in the ServiceWorkerContext from UI thread. | 23 // versions in the ServiceWorkerContext from UI thread. |
| 23 class ServiceWorkerContextWatcher | 24 class ServiceWorkerContextWatcher |
| 24 : public ServiceWorkerContextObserver, | 25 : public ServiceWorkerContextObserver, |
| 25 public base::RefCountedThreadSafe<ServiceWorkerContextWatcher> { | 26 public base::RefCountedThreadSafe<ServiceWorkerContextWatcher> { |
| 26 public: | 27 public: |
| 27 typedef base::Callback<void( | 28 typedef base::Callback<void( |
| 28 const std::vector<ServiceWorkerRegistrationInfo>&)> | 29 const std::vector<ServiceWorkerRegistrationInfo>&)> |
| 29 WorkerRegistrationUpdatedCallback; | 30 WorkerRegistrationUpdatedCallback; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void SendVersionInfo(const ServiceWorkerVersionInfo& version); | 66 void SendVersionInfo(const ServiceWorkerVersionInfo& version); |
| 66 | 67 |
| 67 // ServiceWorkerContextObserver implements | 68 // ServiceWorkerContextObserver implements |
| 68 void OnNewLiveRegistration(int64_t registration_id, | 69 void OnNewLiveRegistration(int64_t registration_id, |
| 69 const GURL& pattern) override; | 70 const GURL& pattern) override; |
| 70 void OnNewLiveVersion(int64_t version_id, | 71 void OnNewLiveVersion(int64_t version_id, |
| 71 int64_t registration_id, | 72 int64_t registration_id, |
| 72 const GURL& script_url) override; | 73 const GURL& script_url) override; |
| 73 void OnRunningStateChanged( | 74 void OnRunningStateChanged( |
| 74 int64_t version_id, | 75 int64_t version_id, |
| 75 content::ServiceWorkerVersion::RunningStatus running_status) override; | 76 content::EmbeddedWorkerStatus running_status) override; |
| 76 void OnVersionStateChanged( | 77 void OnVersionStateChanged( |
| 77 int64_t version_id, | 78 int64_t version_id, |
| 78 content::ServiceWorkerVersion::Status status) override; | 79 content::ServiceWorkerVersion::Status status) override; |
| 79 void OnMainScriptHttpResponseInfoSet( | 80 void OnMainScriptHttpResponseInfoSet( |
| 80 int64_t version_id, | 81 int64_t version_id, |
| 81 base::Time script_response_time, | 82 base::Time script_response_time, |
| 82 base::Time script_last_modified) override; | 83 base::Time script_last_modified) override; |
| 83 void OnErrorReported(int64_t version_id, | 84 void OnErrorReported(int64_t version_id, |
| 84 int process_id, | 85 int process_id, |
| 85 int thread_id, | 86 int thread_id, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 104 version_info_map_; | 105 version_info_map_; |
| 105 scoped_refptr<ServiceWorkerContextWrapper> context_; | 106 scoped_refptr<ServiceWorkerContextWrapper> context_; |
| 106 WorkerRegistrationUpdatedCallback registration_callback_; | 107 WorkerRegistrationUpdatedCallback registration_callback_; |
| 107 WorkerVersionUpdatedCallback version_callback_; | 108 WorkerVersionUpdatedCallback version_callback_; |
| 108 WorkerErrorReportedCallback error_callback_; | 109 WorkerErrorReportedCallback error_callback_; |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace content | 112 } // namespace content |
| 112 | 113 |
| 113 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ | 114 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ |
| OLD | NEW |