Index: third_party/WebKit/Source/core/workers/WorkerThread.cpp |
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
index 7b31a57783e4fec5f853f6ca1d08b36bd671f2a1..04f79327f5d29667a506f42feec5a94ec818638b 100644 |
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
@@ -54,6 +54,8 @@ |
namespace blink { |
+std::set<v8::Isolate*>* WorkerThread::gIsolates = nullptr; |
+ |
class WorkerMicrotaskRunner : public WebThread::TaskObserver { |
public: |
explicit WorkerMicrotaskRunner(WorkerThread* workerThread) |
@@ -210,6 +212,9 @@ void WorkerThread::initialize(PassOwnPtr<WorkerThreadStartupData> startupData) |
backingThread().addTaskObserver(m_microtaskRunner.get()); |
m_isolate = initializeIsolate(); |
+ if (!gIsolates) |
+ gIsolates = new std::set<v8::Isolate*>(); |
+ gIsolates->insert(m_isolate); |
kinuko
2016/04/11 09:30:40
For compositor worker (where single thread is shar
hong.zheng
2016/04/15 06:05:57
use WorkerBackingThread instead
|
// Optimize for memory usage instead of latency for the worker isolate. |
m_isolate->IsolateInBackgroundNotification(); |
m_workerGlobalScope = createWorkerGlobalScope(startupData); |
@@ -277,6 +282,7 @@ void WorkerThread::performShutdownTask() |
willDestroyIsolate(); |
shutdownBackingThread(); |
destroyIsolate(); |
+ gIsolates->erase(m_isolate); |
m_isolate = nullptr; |
m_microtaskRunner = nullptr; |
@@ -501,4 +507,10 @@ void WorkerThread::stopRunningDebuggerTasksOnPause() |
m_pausedInDebugger = false; |
} |
+// static |
+std::set<v8::Isolate*>* WorkerThread::workerThreadIsolates() |
+{ |
+ return gIsolates; |
kinuko
2016/04/11 09:30:40
We seem to be accessing this set from multiple thr
hong.zheng
2016/04/15 06:05:57
Done.
|
+} |
+ |
} // namespace blink |