OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ThreadedWorkletObjectProxy_h | 5 #ifndef ThreadedWorkletObjectProxy_h |
6 #define ThreadedWorkletObjectProxy_h | 6 #define ThreadedWorkletObjectProxy_h |
7 | 7 |
8 #include "bindings/core/v8/SourceLocation.h" | 8 #include "bindings/core/v8/SourceLocation.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/dom/MessagePort.h" | 10 #include "core/dom/MessagePort.h" |
11 #include "core/workers/ThreadedObjectProxyBase.h" | 11 #include "core/workers/ThreadedObjectProxyBase.h" |
12 #include "core/workers/WorkerReportingProxy.h" | 12 #include "core/workers/WorkerReportingProxy.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ThreadedWorkletMessagingProxy; | 16 class ThreadedWorkletMessagingProxy; |
17 class WorkerThread; | 17 class WorkerThread; |
18 | 18 |
19 // A proxy to talk to the parent worker object. See class comments on | 19 // A proxy to talk to the parent worker object. See class comments on |
20 // ThreadedObjectProxyBase.h for lifetime of this class etc. | 20 // ThreadedObjectProxyBase.h for lifetime of this class etc. |
21 class CORE_EXPORT ThreadedWorkletObjectProxy : public ThreadedObjectProxyBase { | 21 class CORE_EXPORT ThreadedWorkletObjectProxy : public ThreadedObjectProxyBase { |
22 USING_FAST_MALLOC(ThreadedWorkletObjectProxy); | 22 USING_FAST_MALLOC(ThreadedWorkletObjectProxy); |
23 WTF_MAKE_NONCOPYABLE(ThreadedWorkletObjectProxy); | 23 WTF_MAKE_NONCOPYABLE(ThreadedWorkletObjectProxy); |
24 | 24 |
25 public: | 25 public: |
26 static std::unique_ptr<ThreadedWorkletObjectProxy> create( | 26 static std::unique_ptr<ThreadedWorkletObjectProxy> create( |
27 const WeakPtr<ThreadedWorkletMessagingProxy>&, | 27 const WeakPtr<ThreadedWorkletMessagingProxy>&); |
28 ParentFrameTaskRunners*); | |
29 ~ThreadedWorkletObjectProxy() override; | 28 ~ThreadedWorkletObjectProxy() override; |
30 | 29 |
31 void evaluateScript(const String& source, | 30 void evaluateScript(const String& source, |
32 const KURL& scriptURL, | 31 const KURL& scriptURL, |
33 WorkerThread*); | 32 WorkerThread*); |
34 | 33 |
35 // ThreadedObjectProxyBase overrides. | 34 // ThreadedObjectProxyBase overrides. |
36 void reportException(const String& errorMessage, | 35 void reportException(const String& errorMessage, |
37 std::unique_ptr<SourceLocation>, | 36 std::unique_ptr<SourceLocation>, |
38 int exceptionId) final {} | 37 int exceptionId) final {} |
39 void didEvaluateWorkerScript(bool success) final {} | 38 void didEvaluateWorkerScript(bool success) final {} |
40 void willDestroyWorkerGlobalScope() final {} | 39 void willDestroyWorkerGlobalScope() final {} |
41 | 40 |
42 protected: | 41 protected: |
43 ThreadedWorkletObjectProxy(const WeakPtr<ThreadedWorkletMessagingProxy>&, | 42 explicit ThreadedWorkletObjectProxy( |
44 ParentFrameTaskRunners*); | 43 const WeakPtr<ThreadedWorkletMessagingProxy>&); |
45 | 44 |
46 WeakPtr<ThreadedMessagingProxyBase> messagingProxyWeakPtr() final; | 45 WeakPtr<ThreadedMessagingProxyBase> messagingProxyWeakPtr() final; |
47 | 46 |
48 private: | 47 private: |
49 // No guarantees about the lifetimes of tasks posted by this proxy wrt the | 48 // No guarantees about the lifetimes of tasks posted by this proxy wrt the |
50 // ThreadedWorkletMessagingProxy so a weak pointer must be used when posting | 49 // ThreadedWorkletMessagingProxy so a weak pointer must be used when posting |
51 // the tasks. | 50 // the tasks. |
52 WeakPtr<ThreadedWorkletMessagingProxy> m_messagingProxyWeakPtr; | 51 WeakPtr<ThreadedWorkletMessagingProxy> m_messagingProxyWeakPtr; |
53 }; | 52 }; |
54 | 53 |
55 } // namespace blink | 54 } // namespace blink |
56 | 55 |
57 #endif // ThreadedWorkletObjectProxy_h | 56 #endif // ThreadedWorkletObjectProxy_h |
OLD | NEW |