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

Unified Diff: Source/platform/WebThreadSupportingGC.cpp

Issue 469683002: Implement WebThreadSupportingGC, which wraps a WebThread attached to Oilpan's GC (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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') | Source/platform/blink_platform.gypi » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..c0b9c3e44dee3529817f7d69c92af30a1bfe5107
--- /dev/null
+++ b/Source/platform/WebThreadSupportingGC.cpp
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "platform/WebThreadSupportingGC.h"
+
+namespace blink {
+
+PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name)
+{
+ return adoptPtr(new WebThreadSupportingGC(name));
+}
+
+WebThreadSupportingGC::WebThreadSupportingGC(const char* name)
+ : m_thread(adoptPtr(blink::Platform::current()->createThread(name)))
+{
+}
+
+void WebThreadSupportingGC::attachGC()
+{
+ m_pendingGCRunner = adoptPtr(new PendingGCRunner);
+ m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(&platformThread()));
+ platformThread().addTaskObserver(m_pendingGCRunner.get());
+ ThreadState::attach();
+ ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get());
+}
+
+void WebThreadSupportingGC::detachGC()
+{
+ ThreadState::current()->removeInterruptor(m_messageLoopInterruptor.get());
+ ThreadState::detach();
+ platformThread().removeTaskObserver(m_pendingGCRunner.get());
+ m_pendingGCRunner = nullptr;
+ m_messageLoopInterruptor = nullptr;
+}
+
+} // namespace blink
« no previous file with comments | « Source/platform/WebThreadSupportingGC.h ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698