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

Unified Diff: Source/platform/WebThreadSupportingGC.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
« no previous file with comments | « Source/platform/WebThreadSupportingGC.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/WebThreadSupportingGC.cpp
diff --git a/Source/platform/WebThreadSupportingGC.cpp b/Source/platform/WebThreadSupportingGC.cpp
index f2aec3e1addf011c63eaf4c1a887c67e01faa58e..549b067b56af1d3990583af1bf8c9959e9250bc5 100644
--- a/Source/platform/WebThreadSupportingGC.cpp
+++ b/Source/platform/WebThreadSupportingGC.cpp
@@ -11,6 +11,29 @@
namespace blink {
+PassOwnPtr<GCSupportForWebThread> GCSupportForWebThread::create(WebThread& thread)
+{
+ return adoptPtr(new GCSupportForWebThread(thread));
+}
+
+GCSupportForWebThread::GCSupportForWebThread(WebThread& thread)
+ : m_thread(thread)
+{
+ m_pendingGCRunner = adoptPtr(new PendingGCRunner);
+ m_thread.addTaskObserver(m_pendingGCRunner.get());
+ ThreadState::attach();
+ OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterruptor(&m_thread));
+ ThreadState::current()->addInterruptor(interruptor.release());
+}
+
+GCSupportForWebThread::~GCSupportForWebThread()
+{
+ m_thread.removeTaskObserver(m_pendingGCRunner.get());
+
+ ThreadState::detach();
+ m_pendingGCRunner = nullptr;
+}
+
PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name)
{
#if ENABLE(ASSERT)
@@ -35,21 +58,14 @@ WebThreadSupportingGC::~WebThreadSupportingGC()
void WebThreadSupportingGC::initialize()
{
- m_pendingGCRunner = adoptPtr(new PendingGCRunner);
- platformThread().addTaskObserver(m_pendingGCRunner.get());
- ThreadState::attach();
- OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterruptor(&platformThread()));
- ThreadState::current()->addInterruptor(interruptor.release());
+ m_gcSupport = GCSupportForWebThread::create(platformThread());
}
void WebThreadSupportingGC::shutdown()
{
// Ensure no posted tasks will run from this point on.
- platformThread().removeTaskObserver(m_pendingGCRunner.get());
platformThread().scheduler()->shutdown();
-
- ThreadState::detach();
- m_pendingGCRunner = nullptr;
+ m_gcSupport.clear();
}
} // namespace blink
« no previous file with comments | « Source/platform/WebThreadSupportingGC.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698