| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ServiceWorkerContainerClient_h | 5 #ifndef ServiceWorkerContainerClient_h |
| 6 #define ServiceWorkerContainerClient_h | 6 #define ServiceWorkerContainerClient_h |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/workers/WorkerClients.h" | 9 #include "core/workers/WorkerClients.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class ExecutionContext; | 16 class ExecutionContext; |
| 17 class WebServiceWorkerProvider; | 17 class WebServiceWorkerProvider; |
| 18 | 18 |
| 19 // This mainly exists to provide access to WebServiceWorkerProvider. | 19 // This mainly exists to provide access to WebServiceWorkerProvider. |
| 20 // Owned by Document (or WorkerClients). | 20 // Owned by Document (or WorkerClients). |
| 21 class MODULES_EXPORT ServiceWorkerContainerClient final | 21 class MODULES_EXPORT ServiceWorkerContainerClient final |
| 22 : public GarbageCollectedFinalized<ServiceWorkerContainerClient>, | 22 : public GarbageCollectedFinalized<ServiceWorkerContainerClient>, |
| 23 public Supplement<Document>, | 23 public Supplement<Document>, |
| 24 public Supplement<WorkerClients> { | 24 public Supplement<WorkerClients> { |
| 25 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); | 25 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); |
| 26 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); | 26 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); |
| 27 | 27 |
| 28 public: | 28 public: |
| 29 static ServiceWorkerContainerClient* create( | 29 ServiceWorkerContainerClient(Document&, |
| 30 std::unique_ptr<WebServiceWorkerProvider>); | 30 std::unique_ptr<WebServiceWorkerProvider>); |
| 31 ServiceWorkerContainerClient(WorkerClients&, |
| 32 std::unique_ptr<WebServiceWorkerProvider>); |
| 31 virtual ~ServiceWorkerContainerClient(); | 33 virtual ~ServiceWorkerContainerClient(); |
| 32 | 34 |
| 33 WebServiceWorkerProvider* provider() { return m_provider.get(); } | 35 WebServiceWorkerProvider* provider() { return m_provider.get(); } |
| 34 | 36 |
| 35 static const char* supplementName(); | 37 static const char* supplementName(); |
| 36 static ServiceWorkerContainerClient* from(ExecutionContext*); | 38 static ServiceWorkerContainerClient* from(ExecutionContext*); |
| 37 | 39 |
| 38 DEFINE_INLINE_VIRTUAL_TRACE() { | 40 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 39 Supplement<Document>::trace(visitor); | 41 Supplement<Document>::trace(visitor); |
| 40 Supplement<WorkerClients>::trace(visitor); | 42 Supplement<WorkerClients>::trace(visitor); |
| 41 } | 43 } |
| 42 | 44 |
| 43 protected: | 45 private: |
| 44 explicit ServiceWorkerContainerClient( | |
| 45 std::unique_ptr<WebServiceWorkerProvider>); | |
| 46 | |
| 47 std::unique_ptr<WebServiceWorkerProvider> m_provider; | 46 std::unique_ptr<WebServiceWorkerProvider> m_provider; |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 MODULES_EXPORT void provideServiceWorkerContainerClientToWorker( | 49 MODULES_EXPORT void provideServiceWorkerContainerClientToWorker( |
| 51 WorkerClients*, | 50 WorkerClients*, |
| 52 std::unique_ptr<WebServiceWorkerProvider>); | 51 std::unique_ptr<WebServiceWorkerProvider>); |
| 53 | 52 |
| 54 } // namespace blink | 53 } // namespace blink |
| 55 | 54 |
| 56 #endif // ServiceWorkerContainerClient_h | 55 #endif // ServiceWorkerContainerClient_h |
| OLD | NEW |