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

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

Issue 1100413004: workers: Move ownership of WebThread from WorkerThread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: reference Created 5 years, 8 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
« no previous file with comments | « Source/core/workers/SharedWorkerThread.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/WorkerThread.h
diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h
index d9bd49b952000d06cc50138b92223b7815c46e40..38352bd1ad6fdb55dd0929b8f73310c828f44454 100644
--- a/Source/core/workers/WorkerThread.h
+++ b/Source/core/workers/WorkerThread.h
@@ -57,6 +57,7 @@ enum WorkerThreadStartMode {
PauseWorkerGlobalScopeOnStart
};
+// TODO(sadrul): Rename to WorkerScript.
class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> {
public:
virtual ~WorkerThread();
@@ -64,7 +65,12 @@ public:
virtual void start();
virtual void stop();
- virtual PassOwnPtr<WebThreadSupportingGC> createWebThreadSupportingGC();
+ // 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 didStartRunLoop();
virtual void didStopRunLoop();
@@ -78,7 +84,7 @@ public:
void terminateAndWait();
static void terminateAndWaitForAllWorkers();
- bool isCurrentThread() const;
+ bool isCurrentThread();
WorkerLoaderProxy* workerLoaderProxy() const
{
RELEASE_ASSERT(m_workerLoaderProxy);
@@ -104,13 +110,13 @@ public:
// Number of active worker threads.
static unsigned workerThreadCount();
- PlatformThreadId platformThreadId() const;
+ PlatformThreadId platformThreadId();
void interruptAndDispatchInspectorCommands();
void setWorkerInspectorController(WorkerInspectorController*);
protected:
- WorkerThread(const char* threadName, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPtr<WorkerThreadStartupData>);
+ WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPtr<WorkerThreadStartupData>);
// Factory method for creating a new worker context for the thread.
virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) = 0;
@@ -135,7 +141,7 @@ private:
void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>, long long delayMs);
- const char* m_threadName;
+ bool m_started;
bool m_terminated;
MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
@@ -158,13 +164,6 @@ private:
// Used to signal thread termination.
OwnPtr<WebWaitableEvent> m_terminationEvent;
-
- // FIXME: This has to be last because of crbug.com/401397 - the
- // WorkerThread might get deleted before it had a chance to properly
- // shut down. By deleting the WebThread first, we can guarantee that
- // no pending tasks on the thread might want to access any of the other
- // members during the WorkerThread's destruction.
- OwnPtr<WebThreadSupportingGC> m_thread;
};
} // namespace blink
« no previous file with comments | « Source/core/workers/SharedWorkerThread.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698