Index: Source/modules/compositorworker/CompositorWorkerManager.cpp |
diff --git a/Source/modules/compositorworker/CompositorWorkerManager.cpp b/Source/modules/compositorworker/CompositorWorkerManager.cpp |
index 62dc23b4c02a2ce82f05a4a82fc2cac2460c447f..cde306703bafde496bae831fb1fb84af8fdce83a 100644 |
--- a/Source/modules/compositorworker/CompositorWorkerManager.cpp |
+++ b/Source/modules/compositorworker/CompositorWorkerManager.cpp |
@@ -20,13 +20,13 @@ namespace { |
static CompositorWorkerManager* s_instance = nullptr; |
-static Mutex& singletonMutex() |
+Mutex& singletonMutex() |
{ |
AtomicallyInitializedStaticReference(Mutex, mutex, new Mutex); |
return mutex; |
} |
-static void destroyThread(WebThreadSupportingGC* thread) |
+void destroyThread(WebThread* thread) |
{ |
delete thread; |
} |
@@ -69,7 +69,11 @@ WebThreadSupportingGC& CompositorWorkerManager::compositorWorkerThread() |
if (!m_thread) { |
ASSERT(isMainThread()); |
ASSERT(!m_workerCount); |
- m_thread = WebThreadSupportingGC::create("CompositorWorker Thread"); |
+ // TODO(sadrul): Instead of creating a new thread, retrieve the thread from |
+ // Platform using a more specialized function |
+ // (e.g. Platform::compositorWorkerThread()). |
+ m_platformThread = adoptPtr(Platform::current()->createThread("CompositorWorker Thread")); |
+ m_thread = WebThreadSupportingGC::createForThread(m_platformThread.get()); |
} |
return *m_thread.get(); |
} |
@@ -102,8 +106,8 @@ void CompositorWorkerManager::shutdownBackingThread() |
--m_workerCount; |
if (m_workerCount == 0) { |
m_thread->shutdown(); |
- Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(destroyThread, AllowCrossThreadAccess(m_thread.leakPtr()))); |
m_thread = nullptr; |
+ Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(destroyThread, AllowCrossThreadAccess(m_platformThread.leakPtr()))); |
} |
} |