OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ThreadedWorkletObjectProxy_h | |
6 #define ThreadedWorkletObjectProxy_h | |
7 | |
8 #include "bindings/core/v8/SourceLocation.h" | |
9 #include "core/CoreExport.h" | |
10 #include "core/dom/MessagePort.h" | |
11 #include "core/workers/WorkerReportingProxy.h" | |
12 | |
13 namespace blink { | |
14 | |
15 class ConsoleMessage; | |
16 class ExecutionContext; | |
17 class ExecutionContextTask; | |
18 class ThreadedWorkletMessagingProxy; | |
19 | |
20 // A proxy to talk to the parent worklet object. This object is created on the | |
21 // main thread, passed on to the worklet thread, and used just to proxy | |
22 // messages to the ThreadedWorkletMessagingProxy on the main thread. | |
23 class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy { | |
24 USING_FAST_MALLOC(ThreadedWorkletObjectProxy); | |
25 WTF_MAKE_NONCOPYABLE(ThreadedWorkletObjectProxy); | |
26 | |
27 public: | |
28 static std::unique_ptr<ThreadedWorkletObjectProxy> create(ThreadedWorkletMes
sagingProxy*); | |
29 ~ThreadedWorkletObjectProxy() override {} | |
30 | |
31 void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>); | |
32 void reportPendingActivity(bool hasPendingActivity); | |
33 | |
34 // WorkerReportingProxy overrides. | |
35 void reportException(const String& errorMessage, std::unique_ptr<SourceLocat
ion>, int exceptionId) override {} | |
36 void reportConsoleMessage(MessageSource, MessageLevel, const String& message
, SourceLocation*) override; | |
37 void postMessageToPageInspector(const String&) override; | |
38 void didEvaluateWorkerScript(bool success) override {} | |
39 void didCloseWorkerGlobalScope() override; | |
40 void willDestroyWorkerGlobalScope() override {} | |
41 void didTerminateWorkerThread() override; | |
42 | |
43 protected: | |
44 ThreadedWorkletObjectProxy(ThreadedWorkletMessagingProxy*); | |
45 | |
46 private: | |
47 ExecutionContext* getExecutionContext() const; | |
48 | |
49 // This object always outlives this proxy. | |
50 ThreadedWorkletMessagingProxy* m_messagingProxy; | |
51 }; | |
52 | |
53 } // namespace blink | |
54 | |
55 #endif // ThreadedWorkletObjectProxy_h | |
OLD | NEW |