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

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

Issue 1319363002: Makes WebThreadSupportingGC constructible for an existing thread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed comments 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
« no previous file with comments | « Source/modules/compositorworker/CompositorWorkerManager.h ('k') | Source/platform/WebThreadSupportingGC.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())));
}
}
« no previous file with comments | « Source/modules/compositorworker/CompositorWorkerManager.h ('k') | Source/platform/WebThreadSupportingGC.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698