Chromium Code Reviews| 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..80a17287c63b4ddbc3dcedeba85239d0493639dd |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h |
| @@ -0,0 +1,59 @@ |
| +// 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" |
|
majidvp
2016/09/14 20:06:31
nit: Timer.h, Handle.h and PassRefPtr.h are unused
ikilpatrick
2016/09/14 21:54:51
Done.
|
| + |
| +namespace blink { |
| + |
| +class ConsoleMessage; |
| +class ExecutionContext; |
| +class ExecutionContextTask; |
| +class ThreadedWorkletMessagingProxy; |
| +class WorkerOrWorkletGlobalScope; |
|
majidvp
2016/09/14 20:06:31
nit: unused.
ikilpatrick
2016/09/14 21:54:51
Done.
|
| + |
| +// 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 didCloseWorkerGlobalScope() override; |
| + void willDestroyWorkerGlobalScope() override {} |
| + void didTerminateWorkerThread() override; |
| + |
| +protected: |
| + ThreadedWorkletObjectProxy(ThreadedWorkletMessagingProxy*); |
| + |
| +private: |
| + ExecutionContext* getExecutionContext() const; |
| + |
| + // This object always outlives this proxy. |
| + ThreadedWorkletMessagingProxy* m_messagingProxy; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ThreadedWorkletObjectProxy_h |