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

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

Issue 2041753002: Worker: Protect a running debugger task from forcible worker termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak if-condition Created 4 years, 6 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 92c7dbe30e5e2029efd02695376b526fe3649d85..f7eb658dd097033bbab2ce0e2858fb33be028a0c 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.h
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
@@ -60,6 +60,14 @@ enum WorkerThreadStartMode {
//
// WorkerThread start and termination must be initiated on the main thread and
// an actual task is executed on the worker thread.
+//
+// When termination starts, (debugger) tasks on WorkerThread are handled as
+// follows:
+// - A running task may finish unless a forcible termination task interrupts.
+// 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:
// Represents how this thread is terminated.
@@ -103,11 +111,9 @@ public:
void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask>);
void appendDebuggerTask(std::unique_ptr<CrossThreadClosure>);
- // Runs only debugger tasks while paused in debugger, called on the worker
- // thread.
- void startRunningDebuggerTasksOnPause();
- void stopRunningDebuggerTasksOnPause();
- bool isRunningDebuggerTasksOnPause() const { return m_pausedInDebugger; }
+ // Runs only debugger tasks while paused in debugger.
+ void startRunningDebuggerTasksOnPauseOnWorkerThread();
+ void stopRunningDebuggerTasksOnPauseOnWorkerThread();
// Can be called only on the worker thread, WorkerGlobalScope is not thread
// safe.
@@ -160,8 +166,8 @@ private:
void prepareForShutdownOnWorkerThread();
void performShutdownOnWorkerThread();
void performTaskOnWorkerThread(std::unique_ptr<ExecutionContextTask>, bool isInstrumented);
- void runDebuggerTaskOnWorkerThread(std::unique_ptr<CrossThreadClosure>);
- void runDebuggerTaskDontWaitOnWorkerThread();
+ void performDebuggerTaskOnWorkerThread(std::unique_ptr<CrossThreadClosure>);
+ void performDebuggerTaskDontWaitOnWorkerThread();
void setForceTerminationDelayInMsForTesting(long long forceTerminationDelayInMs) { m_forceTerminationDelayInMs = forceTerminationDelayInMs; }

Powered by Google App Engine
This is Rietveld 408576698