| 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 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class ExecutionContext; | 16 class ExecutionContext; |
| 16 class WebServiceWorkerProvider; | 17 class WebServiceWorkerProvider; |
| 17 | 18 |
| 18 // This mainly exists to provide access to WebServiceWorkerProvider. | 19 // This mainly exists to provide access to WebServiceWorkerProvider. |
| 19 // Owned by Document (or WorkerClients). | 20 // Owned by Document (or WorkerClients). |
| 20 class MODULES_EXPORT ServiceWorkerContainerClient final | 21 class MODULES_EXPORT ServiceWorkerContainerClient final |
| 21 : public GarbageCollectedFinalized<ServiceWorkerContainerClient> | 22 : public GarbageCollectedFinalized<ServiceWorkerContainerClient> |
| 22 , public Supplement<Document> | 23 , public Supplement<Document> |
| 23 , public Supplement<WorkerClients> { | 24 , public Supplement<WorkerClients> { |
| 24 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); | 25 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); |
| 25 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); | 26 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); |
| 26 public: | 27 public: |
| 27 static ServiceWorkerContainerClient* create(PassOwnPtr<WebServiceWorkerProvi
der>); | 28 static ServiceWorkerContainerClient* create(std::unique_ptr<WebServiceWorker
Provider>); |
| 28 virtual ~ServiceWorkerContainerClient(); | 29 virtual ~ServiceWorkerContainerClient(); |
| 29 | 30 |
| 30 WebServiceWorkerProvider* provider() { return m_provider.get(); } | 31 WebServiceWorkerProvider* provider() { return m_provider.get(); } |
| 31 | 32 |
| 32 static const char* supplementName(); | 33 static const char* supplementName(); |
| 33 static ServiceWorkerContainerClient* from(ExecutionContext*); | 34 static ServiceWorkerContainerClient* from(ExecutionContext*); |
| 34 | 35 |
| 35 DEFINE_INLINE_VIRTUAL_TRACE() | 36 DEFINE_INLINE_VIRTUAL_TRACE() |
| 36 { | 37 { |
| 37 Supplement<Document>::trace(visitor); | 38 Supplement<Document>::trace(visitor); |
| 38 Supplement<WorkerClients>::trace(visitor); | 39 Supplement<WorkerClients>::trace(visitor); |
| 39 } | 40 } |
| 40 | 41 |
| 41 protected: | 42 protected: |
| 42 explicit ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider>); | 43 explicit ServiceWorkerContainerClient(std::unique_ptr<WebServiceWorkerProvid
er>); |
| 43 | 44 |
| 44 OwnPtr<WebServiceWorkerProvider> m_provider; | 45 std::unique_ptr<WebServiceWorkerProvider> m_provider; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*,
PassOwnPtr<WebServiceWorkerProvider>); | 48 MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*,
std::unique_ptr<WebServiceWorkerProvider>); |
| 48 | 49 |
| 49 } // namespace blink | 50 } // namespace blink |
| 50 | 51 |
| 51 #endif // ServiceWorkerContainerClient_h | 52 #endif // ServiceWorkerContainerClient_h |
| OLD | NEW |