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

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

Issue 1749073002: Do V8 GC ASAP if system memory is pressured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: send synchronous notification to worker thread Created 4 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.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

Powered by Google App Engine
This is Rietveld 408576698