OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 WebSharedWorkerReportingProxyImpl_h | 5 #ifndef WebSharedWorkerReportingProxyImpl_h |
6 #define WebSharedWorkerReportingProxyImpl_h | 6 #define WebSharedWorkerReportingProxyImpl_h |
7 | 7 |
8 #include "core/workers/ParentFrameTaskRunners.h" | 8 #include "core/workers/WorkerOrWorkletGlobalScope.h" |
9 #include "core/workers/WorkerReportingProxy.h" | 9 #include "core/workers/WorkerReportingProxy.h" |
10 #include "platform/heap/GarbageCollected.h" | 10 #include "platform/heap/GarbageCollected.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class WebSharedWorkerImpl; | 14 class WebSharedWorkerImpl; |
15 | 15 |
16 // An implementation of WorkerReportingProxy for SharedWorker. This is created | 16 // An implementation of WorkerReportingProxy for SharedWorker. This is created |
17 // and owned by WebSharedWorkerImpl on the main thread, accessed from a worker | 17 // and owned by WebSharedWorkerImpl on the main thread, accessed from a worker |
18 // thread, and destroyed on the main thread. | 18 // thread, and destroyed on the main thread. |
19 class WebSharedWorkerReportingProxyImpl final | 19 class WebSharedWorkerReportingProxyImpl final |
20 : public GarbageCollectedFinalized<WebSharedWorkerReportingProxyImpl>, | 20 : public GarbageCollectedFinalized<WebSharedWorkerReportingProxyImpl>, |
21 public WorkerReportingProxy { | 21 public WorkerReportingProxy { |
22 WTF_MAKE_NONCOPYABLE(WebSharedWorkerReportingProxyImpl); | 22 WTF_MAKE_NONCOPYABLE(WebSharedWorkerReportingProxyImpl); |
23 | 23 |
24 public: | 24 public: |
25 WebSharedWorkerReportingProxyImpl(WebSharedWorkerImpl*, | 25 explicit WebSharedWorkerReportingProxyImpl(WebSharedWorkerImpl*); |
26 ParentFrameTaskRunners*); | |
27 ~WebSharedWorkerReportingProxyImpl() override; | 26 ~WebSharedWorkerReportingProxyImpl() override; |
28 | 27 |
29 // WorkerReportingProxy methods: | 28 // WorkerReportingProxy methods: |
30 void countFeature(UseCounter::Feature) override; | 29 void countFeature(UseCounter::Feature) override; |
31 void countDeprecation(UseCounter::Feature) override; | 30 void countDeprecation(UseCounter::Feature) override; |
32 void reportException(const WTF::String&, | 31 void reportException(const WTF::String&, |
33 std::unique_ptr<SourceLocation>, | 32 std::unique_ptr<SourceLocation>, |
34 int exceptionId) override; | 33 int exceptionId) override; |
35 void reportConsoleMessage(MessageSource, | 34 void reportConsoleMessage(MessageSource, |
36 MessageLevel, | 35 MessageLevel, |
37 const String& message, | 36 const String& message, |
38 SourceLocation*) override; | 37 SourceLocation*) override; |
39 void postMessageToPageInspector(const WTF::String&) override; | 38 void postMessageToPageInspector(const WTF::String&) override; |
| 39 void didCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override; |
40 void didEvaluateWorkerScript(bool success) override {} | 40 void didEvaluateWorkerScript(bool success) override {} |
41 void didCloseWorkerGlobalScope() override; | 41 void didCloseWorkerGlobalScope() override; |
42 void willDestroyWorkerGlobalScope() override {} | 42 void willDestroyWorkerGlobalScope() override {} |
43 void didTerminateWorkerThread() override; | 43 void didTerminateWorkerThread() override; |
44 | 44 |
45 DECLARE_TRACE(); | 45 DECLARE_TRACE(); |
46 | 46 |
47 private: | 47 private: |
48 // Not owned because this outlives the reporting proxy. | 48 // Not owned because this outlives the reporting proxy. |
49 WebSharedWorkerImpl* m_worker; | 49 WebSharedWorkerImpl* m_worker; |
50 | 50 |
51 Member<ParentFrameTaskRunners> m_parentFrameTaskRunners; | 51 CrossThreadPersistent<WorkerOrWorkletGlobalScope> m_globalScope; |
52 }; | 52 }; |
53 | 53 |
54 } // namespace blink | 54 } // namespace blink |
55 | 55 |
56 #endif // WebSharedWorkerReportingProxyImpl_h | 56 #endif // WebSharedWorkerReportingProxyImpl_h |
OLD | NEW |