Chromium Code Reviews| Index: third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h |
| diff --git a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h |
| index 770719fe2b78f6f1ea953bd73d5768a7a0f5ffa8..a0543dd29b0d11cfb8ed85b3d37834f979b92aed 100644 |
| --- a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h |
| +++ b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h |
| @@ -32,13 +32,17 @@ |
| #define WorkerLoaderProxy_h |
| #include "core/CoreExport.h" |
| -#include "core/dom/ExecutionContext.h" |
| #include "public/platform/WebTraceLocation.h" |
| #include "wtf/Forward.h" |
| +#include "wtf/Functional.h" |
| +#include "wtf/PassRefPtr.h" |
| #include "wtf/ThreadSafeRefCounted.h" |
| +#include "wtf/ThreadingPrimitives.h" |
| namespace blink { |
| +class ExecutionContext; |
| + |
| // The WorkerLoaderProxy is a proxy to the loader context. Normally, the |
| // document on the main thread provides loading services for the subordinate |
| // workers. WorkerLoaderProxy provides 2-way communications to the Document |
| @@ -64,13 +68,17 @@ class CORE_EXPORT WorkerLoaderProxyProvider { |
| // Posts a task to the thread which runs the loading code (normally, the main |
| // thread). This must be called from a worker thread. |
| virtual void postTaskToLoader(const WebTraceLocation&, |
| - std::unique_ptr<ExecutionContextTask>) = 0; |
| + std::unique_ptr<WTF::CrossThreadClosure>) = 0; |
| // Posts callbacks from loading code to the WorkerGlobalScope. This must be |
| // called from the main thread. |
| virtual void postTaskToWorkerGlobalScope( |
| const WebTraceLocation&, |
| std::unique_ptr<WTF::CrossThreadClosure>) = 0; |
| + |
| + // It is guaranteed that this gets accessed only on the thread where |
| + // the ExecutionContext is bound. |
| + virtual ExecutionContext* getLoaderExecutionContext() = 0; |
| }; |
| class CORE_EXPORT WorkerLoaderProxy final |
| @@ -85,12 +93,15 @@ class CORE_EXPORT WorkerLoaderProxy final |
| // This must be called from a worker thread. |
| void postTaskToLoader(const WebTraceLocation&, |
| - std::unique_ptr<ExecutionContextTask>); |
| + std::unique_ptr<WTF::CrossThreadClosure>); |
| // This must be called from the main thread. |
| void postTaskToWorkerGlobalScope(const WebTraceLocation&, |
| std::unique_ptr<WTF::CrossThreadClosure>); |
| + // This may return nullptr. |
|
nhiroki
2017/02/23 05:27:12
Can you add a comment about thread restriction?
kinuko
2017/02/23 07:35:29
Done.
|
| + ExecutionContext* getLoaderExecutionContext(); |
| + |
| // Notification from the provider that it can no longer be accessed. An |
| // implementation of WorkerLoaderProxyProvider is required to call |
| // detachProvider() when finalizing. This must be called from the main thread. |
| @@ -99,7 +110,7 @@ class CORE_EXPORT WorkerLoaderProxy final |
| private: |
| explicit WorkerLoaderProxy(WorkerLoaderProxyProvider*); |
| - Mutex m_lock; |
| + WTF::Mutex m_lock; |
| WorkerLoaderProxyProvider* m_loaderProxyProvider; |
| }; |