| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 EXTENSIONS_BROWSER_SERVICE_WORKER_DATA_H_ | 5 #ifndef EXTENSIONS_BROWSER_SERVICE_WORKER_DATA_H_ |
| 6 #define EXTENSIONS_BROWSER_SERVICE_WORKER_DATA_H_ | 6 #define EXTENSIONS_BROWSER_SERVICE_WORKER_DATA_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "extensions/renderer/service_worker_request_sender.h" | 11 #include "extensions/renderer/service_worker_request_sender.h" |
| 12 #include "extensions/renderer/v8_schema_registry.h" | 12 #include "extensions/renderer/v8_schema_registry.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 class WorkerThreadDispatcher; | 15 class WorkerThreadDispatcher; |
| 16 | 16 |
| 17 // Per ServiceWorker data in worker thread. | 17 // Per ServiceWorker data in worker thread. |
| 18 // Contains: RequestSender, V8SchemaRegistry. | 18 // Contains: RequestSender, V8SchemaRegistry. |
| 19 // TODO(lazyboy): Also put worker ScriptContexts in this. | 19 // TODO(lazyboy): Also put worker ScriptContexts in this. |
| 20 class ServiceWorkerData { | 20 class ServiceWorkerData { |
| 21 public: | 21 public: |
| 22 ServiceWorkerData(WorkerThreadDispatcher* dispatcher, int embedded_worker_id); | 22 ServiceWorkerData(WorkerThreadDispatcher* dispatcher, |
| 23 int64_t service_worker_version_id); |
| 23 ~ServiceWorkerData(); | 24 ~ServiceWorkerData(); |
| 24 | 25 |
| 25 V8SchemaRegistry* v8_schema_registry() { return v8_schema_registry_.get(); } | 26 V8SchemaRegistry* v8_schema_registry() { return v8_schema_registry_.get(); } |
| 26 RequestSender* request_sender() { return request_sender_.get(); } | 27 ServiceWorkerRequestSender* request_sender() { return request_sender_.get(); } |
| 27 int embedded_worker_id() const { return embedded_worker_id_; } | 28 int64_t service_worker_version_id() const { |
| 29 return service_worker_version_id_; |
| 30 } |
| 28 | 31 |
| 29 private: | 32 private: |
| 30 const int embedded_worker_id_; | 33 const int64_t service_worker_version_id_; |
| 31 | 34 |
| 32 std::unique_ptr<V8SchemaRegistry> v8_schema_registry_; | 35 std::unique_ptr<V8SchemaRegistry> v8_schema_registry_; |
| 33 std::unique_ptr<ServiceWorkerRequestSender> request_sender_; | 36 std::unique_ptr<ServiceWorkerRequestSender> request_sender_; |
| 34 | 37 |
| 35 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerData); | 38 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerData); |
| 36 }; | 39 }; |
| 37 | 40 |
| 38 } // namespace extensions | 41 } // namespace extensions |
| 39 | 42 |
| 40 #endif // EXTENSIONS_BROWSER_SERVICE_WORKER_DATA_H_ | 43 #endif // EXTENSIONS_BROWSER_SERVICE_WORKER_DATA_H_ |
| OLD | NEW |