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

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

Issue 2832763002: Reland of Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: Original CL Created 3 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
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 eba1dc13bc5ce66fc4567d55980072b57275afa6..d8da5e4a5df375042379c522d010894562c4f527 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.h
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
@@ -37,6 +37,7 @@
#include "platform/LifecycleNotifier.h"
#include "platform/WaitableEvent.h"
#include "platform/WebTaskRunner.h"
+#include "platform/scheduler/child/worker_global_scope_scheduler.h"
#include "platform/wtf/Forward.h"
#include "platform/wtf/Functional.h"
#include "platform/wtf/PassRefPtr.h"
@@ -92,7 +93,6 @@
// If the running task is for debugger, it's guaranteed to finish without
// any interruptions.
// - Queued tasks never run.
-// - postTask() and appendDebuggerTask() reject posting new tasks.
class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
public:
// Represents how this thread is terminated. Used for UMA. Append only.
@@ -137,9 +137,6 @@
return worker_reporting_proxy_;
}
- void PostTask(const WebTraceLocation&, std::unique_ptr<WTF::Closure>);
- void PostTask(const WebTraceLocation&,
- std::unique_ptr<WTF::CrossThreadClosure>);
void AppendDebuggerTask(std::unique_ptr<CrossThreadClosure>);
// Runs only debugger tasks while paused in debugger.
@@ -174,6 +171,10 @@
ParentFrameTaskRunners* GetParentFrameTaskRunners() const {
return parent_frame_task_runners_.Get();
+ }
+
+ scheduler::WorkerGlobalScopeScheduler* GetGlobalScopeScheduler() const {
+ return global_scope_scheduler_.get();
}
protected:
@@ -243,12 +244,7 @@
// |m_threadStateMutex| acquired.
void ForciblyTerminateExecution(const MutexLocker&, ExitCode);
- // Returns true if termination or shutdown sequence has started. This is
- // thread safe.
- // Note that this returns false when the sequence has already started but it
- // hasn't been notified to the calling thread.
- bool IsInShutdown();
-
+ void InitializeSchedulerOnWorkerThread(WaitableEvent*);
void InitializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>);
void PrepareForShutdownOnWorkerThread();
void PerformShutdownOnWorkerThread();
@@ -294,7 +290,13 @@
RefPtr<WorkerLoaderProxy> worker_loader_proxy_;
WorkerReportingProxy& worker_reporting_proxy_;
+
CrossThreadPersistent<ParentFrameTaskRunners> parent_frame_task_runners_;
+
+ // Tasks managed by this scheduler are canceled when the global scope is
+ // closed.
+ std::unique_ptr<scheduler::WorkerGlobalScopeScheduler>
+ global_scope_scheduler_;
// This lock protects |m_globalScope|, |m_requestedToTerminate|,
// |m_threadState|, |m_runningDebuggerTask| and |m_exitCode|.

Powered by Google App Engine
This is Rietveld 408576698