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 NoBaseWillBeGarbageCollectedFinalized<ServiceWorkerContainerClient> | 21 : public NoBaseWillBeGarbageCollectedFinalized<ServiceWorkerContainerClient> |
22 , public WillBeHeapSupplement<Document> | 22 , public WillBeHeapSupplement<Document> |
23 , public WillBeHeapSupplement<WorkerClients> { | 23 , public WillBeHeapSupplement<WorkerClients> { |
24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); | 24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); |
25 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); | 25 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); |
| 26 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(ServiceWorkerContainerClient); |
26 public: | 27 public: |
27 static PassOwnPtrWillBeRawPtr<ServiceWorkerContainerClient> create(PassOwnPt
r<WebServiceWorkerProvider>); | 28 static PassOwnPtrWillBeRawPtr<ServiceWorkerContainerClient> create(PassOwnPt
r<WebServiceWorkerProvider>); |
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 WillBeHeapSupplement<Document>::trace(visitor); | 38 WillBeHeapSupplement<Document>::trace(visitor); |
38 WillBeHeapSupplement<WorkerClients>::trace(visitor); | 39 WillBeHeapSupplement<WorkerClients>::trace(visitor); |
39 } | 40 } |
40 | 41 |
41 protected: | 42 protected: |
42 explicit ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider>); | 43 explicit ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider>); |
43 | 44 |
44 OwnPtr<WebServiceWorkerProvider> m_provider; | 45 OwnPtr<WebServiceWorkerProvider> m_provider; |
45 }; | 46 }; |
46 | 47 |
47 MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*,
PassOwnPtr<WebServiceWorkerProvider>); | 48 MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*,
PassOwnPtr<WebServiceWorkerProvider>); |
48 | 49 |
49 } // namespace blink | 50 } // namespace blink |
50 | 51 |
51 #endif // ServiceWorkerContainerClient_h | 52 #endif // ServiceWorkerContainerClient_h |
OLD | NEW |