Chromium Code Reviews| Index: third_party/WebKit/Source/core/workers/WorkerThread.h |
| diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.h b/third_party/WebKit/Source/core/workers/WorkerThread.h |
| index 3282ee46c149a2a37e26f5bcdedec1a482e71959..b17fba2cfb8a041d7cd4ef20ace52dbea710a21e 100644 |
| --- a/third_party/WebKit/Source/core/workers/WorkerThread.h |
| +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h |
| @@ -44,6 +44,7 @@ |
| namespace blink { |
| class WaitableEvent; |
| +class WorkerBackingThread; |
| class WorkerGlobalScope; |
| class WorkerInspectorController; |
| class WorkerMicrotaskRunner; |
| @@ -64,16 +65,9 @@ public: |
| void start(PassOwnPtr<WorkerThreadStartupData>); |
| void terminate(); |
| - // Returns the thread this worker runs on. Some implementations can create |
| - // a new thread on the first call (e.g. shared, dedicated workers), whereas |
| - // some implementations can use an existing thread that is already being |
| - // used by other workers (e.g. compositor workers). |
| - virtual WebThreadSupportingGC& backingThread() = 0; |
| - |
| - virtual void didStartWorkerThread(); |
| - virtual void willStopWorkerThread(); |
| - |
| - v8::Isolate* isolate() const { return m_isolate; } |
| + WorkerBackingThread& workerBackingThread(); |
| + WebThreadSupportingGC& backingThread(); |
|
kinuko
2016/02/29 09:32:53
It feels unfortunate that we need to expose two ba
yhirano
2016/02/29 23:47:32
Done.
|
| + v8::Isolate* isolate() const; |
| // Can be used to wait for this worker thread to shut down. |
| // (This is signaled on the main thread, so it's assumed to be waited on |
| @@ -126,22 +120,13 @@ public: |
| void setWorkerInspectorController(WorkerInspectorController*); |
| protected: |
| - WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); |
| + WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassRefPtr<WorkerBackingThread>); |
| // Factory method for creating a new worker context for the thread. |
| virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) = 0; |
| virtual void postInitialize() { } |
| - // Both of these methods are called in the worker thread. |
| - virtual void initializeBackingThread(); |
| - virtual void shutdownBackingThread(); |
| - |
| - virtual v8::Isolate* initializeIsolate(); |
| - virtual void willDestroyIsolate(); |
| - virtual void destroyIsolate(); |
| - virtual void terminateV8Execution(); |
| - |
| private: |
| class DebuggerTaskQueue; |
| friend class WorkerMicrotaskRunner; |
| @@ -171,12 +156,12 @@ private: |
| RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorController; |
| Mutex m_workerInspectorControllerMutex; |
| - // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_shutdown|, |m_isolate| and |m_microtaskRunner|. |
| + // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_shutdown| and |m_microtaskRunner|. |
| Mutex m_threadStateMutex; |
| RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
| - v8::Isolate* m_isolate; |
| + RefPtr<WorkerBackingThread> m_workerBackingThread; |
| // Used to signal thread shutdown. |
| OwnPtr<WaitableEvent> m_shutdownEvent; |