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

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

Issue 2025783002: Worker: Introduce an observation mechanism for WorkerThread termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delayed_task
Patch Set: maybe fix tests 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..9c3c9bec643250c643eaecdc737a896cf31d4e08 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.h
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
@@ -32,6 +32,7 @@
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerLoaderProxy.h"
+#include "core/workers/WorkerThreadLifecycleObserver.h"
#include "wtf/Forward.h"
#include "wtf/Functional.h"
#include "wtf/OwnPtr.h"
@@ -53,6 +54,10 @@ enum WorkerThreadStartMode {
PauseWorkerGlobalScopeOnStart
};
+class WorkerThreadContext : public GarbageCollectedFinalized<WorkerThreadContext>, public LifecycleNotifier<WorkerThreadContext, WorkerThreadLifecycleObserver> {
+ USING_GARBAGE_COLLECTED_MIXIN(WorkerThreadContext);
+};
+
// WorkerThread is a kind of WorkerBackingThread client. Each worker mechanism
// can access the lower thread infrastructure via an implementation of this
// abstract class. Multiple WorkerThreads can share one WorkerBackingThread.
@@ -123,6 +128,11 @@ public:
ExitCode getExitCode();
+ WorkerThreadContext* workerThreadContext()
+ {
+ return m_workerThreadContext.get();
+ }
+
protected:
WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&);
@@ -196,6 +206,8 @@ private:
// Scheduled when termination starts with TerminationMode::Force, and
// cancelled when the worker thread is gracefully shut down.
OwnPtr<ForceTerminationTask> m_scheduledForceTerminationTask;
+
+ Persistent<WorkerThreadContext> m_workerThreadContext;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698