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

Unified Diff: Source/modules/compositorworker/CompositorWorkerManager.cpp

Issue 1274023003: compositor-worker: Get the thread to run compositor-workers from the Platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 4 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: Source/modules/compositorworker/CompositorWorkerManager.cpp
diff --git a/Source/modules/compositorworker/CompositorWorkerManager.cpp b/Source/modules/compositorworker/CompositorWorkerManager.cpp
index 62dc23b4c02a2ce82f05a4a82fc2cac2460c447f..70430cbc33d269c9836cfb3ef1991bf8b2b5bf8c 100644
--- a/Source/modules/compositorworker/CompositorWorkerManager.cpp
+++ b/Source/modules/compositorworker/CompositorWorkerManager.cpp
@@ -26,7 +26,7 @@ static Mutex& singletonMutex()
return mutex;
}
-static void destroyThread(WebThreadSupportingGC* thread)
+static void destroyThread(WebThread* thread)
{
delete thread;
}
@@ -63,15 +63,17 @@ CompositorWorkerManager::~CompositorWorkerManager()
{
}
-WebThreadSupportingGC& CompositorWorkerManager::compositorWorkerThread()
+WebThread& CompositorWorkerManager::compositorWorkerThread()
{
MutexLocker lock(m_mutex);
if (!m_thread) {
ASSERT(isMainThread());
ASSERT(!m_workerCount);
- m_thread = WebThreadSupportingGC::create("CompositorWorker Thread");
+ // TODO(sad): Instead of creating a new thread, retrieve the thread from Platform using a more
+ // specialized function (e.g. Platform::comositorWorkerThread()).
+ m_thread = adoptPtr(Platform::current()->createThread("CompositorWorker Thread"));
}
- return *m_thread.get();
+ return *m_thread;
}
void CompositorWorkerManager::initializeBackingThread()
@@ -82,7 +84,8 @@ void CompositorWorkerManager::initializeBackingThread()
if (m_workerCount > 1)
return;
- m_thread->initialize();
+ ASSERT(!m_gcSupport);
+ m_gcSupport = GCSupportForWebThread::create(*m_thread);
// Initialize the isolate at the same time.
ASSERT(!m_isolate);
@@ -101,7 +104,7 @@ void CompositorWorkerManager::shutdownBackingThread()
ASSERT(m_workerCount > 0);
--m_workerCount;
if (m_workerCount == 0) {
- m_thread->shutdown();
+ m_gcSupport.clear();
Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(destroyThread, AllowCrossThreadAccess(m_thread.leakPtr())));
m_thread = nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698