Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: third_party/WebKit/Source/core/workers/WorkerThread.h

Issue 1733353004: Introduce WorkerBackingThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698