Index: third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h |
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e7e28f098a396c428d376912df36878694eaf98e |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ThreadedWorkletObjectProxy_h |
+#define ThreadedWorkletObjectProxy_h |
+ |
+#include "bindings/core/v8/SourceLocation.h" |
+#include "core/CoreExport.h" |
+#include "core/dom/MessagePort.h" |
+#include "core/workers/WorkerReportingProxy.h" |
+#include "platform/Timer.h" |
+#include "platform/heap/Handle.h" |
+#include "wtf/PassRefPtr.h" |
+ |
+namespace blink { |
+ |
+class ConsoleMessage; |
+class ExecutionContext; |
+class ExecutionContextTask; |
+class ThreadedWorkletMessagingProxy; |
+class WorkerOrWorkletGlobalScope; |
+ |
+// A proxy to talk to the parent worklet object. This object is created on the |
+// main thread, passed on to the worklet thread, and used just to proxy |
+// messages to the ThreadedWorkletMessagingProxy on the main thread. |
+class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy { |
+ USING_FAST_MALLOC(ThreadedWorkletObjectProxy); |
+ WTF_MAKE_NONCOPYABLE(ThreadedWorkletObjectProxy); |
+ |
+public: |
+ static std::unique_ptr<ThreadedWorkletObjectProxy> create(ThreadedWorkletMessagingProxy*); |
+ ~ThreadedWorkletObjectProxy() override {} |
+ |
+ void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>); |
+ void reportPendingActivity(bool hasPendingActivity); |
+ |
+ // WorkerReportingProxy overrides. |
+ void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>, int exceptionId) override {} |
+ void reportConsoleMessage(MessageSource, MessageLevel, const String& message, SourceLocation*) override; |
+ void postMessageToPageInspector(const String&) override; |
+ void didEvaluateWorkerScript(bool success) override {} |
+ void workerGlobalScopeStarted(WorkerOrWorkletGlobalScope*) override {} |
+ void workerGlobalScopeClosed() override; |
+ void workerThreadTerminated() override; |
+ void willDestroyWorkerGlobalScope() override {} |
+ |
+protected: |
+ ThreadedWorkletObjectProxy(ThreadedWorkletMessagingProxy*); |
+ |
+private: |
+ ExecutionContext* getExecutionContext() const; |
+ |
+ // This object always outlives this proxy. |
+ ThreadedWorkletMessagingProxy* m_messagingProxy; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // ThreadedWorkletObjectProxy_h |