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 #include "platform/Timer.h" |
| 13 #include "platform/heap/Handle.h" |
| 14 #include "wtf/PassRefPtr.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class ConsoleMessage; |
| 19 class ExecutionContext; |
| 20 class ExecutionContextTask; |
| 21 class ThreadedWorkletMessagingProxy; |
| 22 class WorkerOrWorkletGlobalScope; |
| 23 |
| 24 // A proxy to talk to the parent worklet object. This object is created on the |
| 25 // main thread, passed on to the worklet thread, and used just to proxy |
| 26 // messages to the ThreadedWorkletMessagingProxy on the main thread. |
| 27 class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy { |
| 28 USING_FAST_MALLOC(ThreadedWorkletObjectProxy); |
| 29 WTF_MAKE_NONCOPYABLE(ThreadedWorkletObjectProxy); |
| 30 |
| 31 public: |
| 32 static std::unique_ptr<ThreadedWorkletObjectProxy> create(ThreadedWorkletMes
sagingProxy*); |
| 33 ~ThreadedWorkletObjectProxy() override {} |
| 34 |
| 35 void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>); |
| 36 void reportPendingActivity(bool hasPendingActivity); |
| 37 |
| 38 // WorkerReportingProxy overrides. |
| 39 void reportException(const String& errorMessage, std::unique_ptr<SourceLocat
ion>, int exceptionId) override {} |
| 40 void reportConsoleMessage(MessageSource, MessageLevel, const String& message
, SourceLocation*) override; |
| 41 void postMessageToPageInspector(const String&) override; |
| 42 void didEvaluateWorkerScript(bool success) override {} |
| 43 void workerGlobalScopeStarted(WorkerOrWorkletGlobalScope*) override {} |
| 44 void workerGlobalScopeClosed() override; |
| 45 void workerThreadTerminated() override; |
| 46 void willDestroyWorkerGlobalScope() override {} |
| 47 |
| 48 protected: |
| 49 ThreadedWorkletObjectProxy(ThreadedWorkletMessagingProxy*); |
| 50 |
| 51 private: |
| 52 ExecutionContext* getExecutionContext() const; |
| 53 |
| 54 // This object always outlives this proxy. |
| 55 ThreadedWorkletMessagingProxy* m_messagingProxy; |
| 56 }; |
| 57 |
| 58 } // namespace blink |
| 59 |
| 60 #endif // ThreadedWorkletObjectProxy_h |
OLD | NEW |