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_RENDERER_SERVICE_WORKER_DATA_H_ | 5 #ifndef EXTENSIONS_RENDERER_SERVICE_WORKER_DATA_H_ |
6 #define EXTENSIONS_RENDERER_SERVICE_WORKER_DATA_H_ | 6 #define EXTENSIONS_RENDERER_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 ExtensionBindingsSystem; | 15 class ExtensionBindingsSystem; |
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(int64_t service_worker_version_id, | 22 ServiceWorkerData(int64_t service_worker_version_id, |
| 23 ScriptContext* context, |
23 std::unique_ptr<ExtensionBindingsSystem> bindings_system); | 24 std::unique_ptr<ExtensionBindingsSystem> bindings_system); |
24 ~ServiceWorkerData(); | 25 ~ServiceWorkerData(); |
25 | 26 |
26 V8SchemaRegistry* v8_schema_registry() { return v8_schema_registry_.get(); } | 27 V8SchemaRegistry* v8_schema_registry() { return v8_schema_registry_.get(); } |
27 ExtensionBindingsSystem* bindings_system() { return bindings_system_.get(); } | 28 ExtensionBindingsSystem* bindings_system() { return bindings_system_.get(); } |
28 int64_t service_worker_version_id() const { | 29 int64_t service_worker_version_id() const { |
29 return service_worker_version_id_; | 30 return service_worker_version_id_; |
30 } | 31 } |
| 32 ScriptContext* context() const { return context_; } |
31 | 33 |
32 private: | 34 private: |
33 const int64_t service_worker_version_id_; | 35 const int64_t service_worker_version_id_; |
| 36 ScriptContext* const context_; |
34 | 37 |
35 std::unique_ptr<V8SchemaRegistry> v8_schema_registry_; | 38 std::unique_ptr<V8SchemaRegistry> v8_schema_registry_; |
36 std::unique_ptr<ExtensionBindingsSystem> bindings_system_; | 39 std::unique_ptr<ExtensionBindingsSystem> bindings_system_; |
37 | 40 |
38 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerData); | 41 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerData); |
39 }; | 42 }; |
40 | 43 |
41 } // namespace extensions | 44 } // namespace extensions |
42 | 45 |
43 #endif // EXTENSIONS_RENDERER_SERVICE_WORKER_DATA_H_ | 46 #endif // EXTENSIONS_RENDERER_SERVICE_WORKER_DATA_H_ |
OLD | NEW |