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

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

Issue 956333002: Refactor TimeBase to post tasks. Workers to use real Idle tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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/WorkerLoaderProxy.h ('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..7f1058ff12af7eba1ede46341e2b8e315af14aa1 100644
--- a/Source/core/workers/WorkerThread.h
+++ b/Source/core/workers/WorkerThread.h
@@ -47,7 +47,6 @@ class WebWaitableEvent;
class WorkerGlobalScope;
class WorkerInspectorController;
class WorkerReportingProxy;
-class WorkerSharedTimer;
class WorkerThreadShutdownFinishTask;
class WorkerThreadStartupData;
class WorkerThreadTask;
@@ -98,8 +97,13 @@ public:
void willEnterNestedLoop();
void didLeaveNestedLoop();
+ // Prevent execution of all non-shutdown tasks.
+ void preShutdown();
+
WorkerGlobalScope* workerGlobalScope() const { return m_workerGlobalScope.get(); }
- bool terminated();
+
+ // Virtual for testing.
+ virtual bool terminated();
// Number of active worker threads.
static unsigned workerThreadCount();
@@ -122,8 +126,21 @@ protected:
virtual void destroyIsolate();
virtual void terminateV8Execution();
+ // This is protected virtual for testing.
+ virtual bool doIdleGc(double deadlineSeconds);
+
+ WebScheduler* schedulerForTesting() const
+ {
+ return m_webScheduler;
+ }
+
+ WebThreadSupportingGC* threadForTesting() const
+ {
+ return m_thread.get();
+ }
+
private:
- friend class WorkerSharedTimer;
+ friend class WorkerThreadIdleTask;
friend class WorkerThreadShutdownFinishTask;
void stopInShutdownSequence();
@@ -131,7 +148,7 @@ private:
void initialize();
void cleanup();
- void idleHandler();
+ void idleTask(double deadlineSeconds);
void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>, long long delayMs);
@@ -159,6 +176,11 @@ private:
// Used to signal thread termination.
OwnPtr<WebWaitableEvent> m_terminationEvent;
+ RawPtr<WebScheduler> m_webScheduler; // NOT OWNED.
+
+ Mutex m_preShutdownMutex;
+ bool m_preShutdown;
+
// 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 previous file with comments | « Source/core/workers/WorkerLoaderProxy.h ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698