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; |
} |