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 cf6ccda60c48906f732f64b14228702f890c4c55..3b3e4321b9f8235d209462c3b4468d5cd6f742a4 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 InspectorTaskRunner; |
class WaitableEvent; |
+class WorkerBackingThread; |
class WorkerGlobalScope; |
class WorkerInspectorController; |
class WorkerMicrotaskRunner; |
@@ -64,16 +65,8 @@ 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(); |
+ 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 |
@@ -115,24 +108,13 @@ public: |
PlatformThreadId platformThreadId(); |
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(); |
- |
- // Can be called either on main or worker thread. |
- virtual void terminateV8Execution(); |
- |
private: |
friend class WorkerMicrotaskRunner; |
@@ -162,12 +144,14 @@ private: |
WorkerReportingProxy& m_workerReportingProxy; |
RawPtr<WebScheduler> m_webScheduler; // Not owned. |
- // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_shutdown|, |m_isolate|, |m_runningDebuggerTask|, |m_shouldTerminateV8Execution| and |m_microtaskRunner|. |
+ // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_shutdown|, |
+ // |m_runningDebuggerTask|, |m_shouldTerminateV8Execution| 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; |