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