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