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

Unified Diff: Source/bindings/core/v8/V8GCController.cpp

Issue 651713002: Oilpan: DOM wrappers don't need to keep persistent handles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
Index: Source/bindings/core/v8/V8GCController.cpp
diff --git a/Source/bindings/core/v8/V8GCController.cpp b/Source/bindings/core/v8/V8GCController.cpp
index f237c7be997ed301c073703c341ea33f0f38f3d3..ed86ebe59960b0c65cdfbef61c9bc76066d24a0f 100644
--- a/Source/bindings/core/v8/V8GCController.cpp
+++ b/Source/bindings/core/v8/V8GCController.cpp
@@ -456,4 +456,34 @@ void V8GCController::reportDOMMemoryUsageToV8(v8::Isolate* isolate)
lastUsageReportedToV8 = currentUsage;
}
+class DOMWrapperTracer : public v8::PersistentHandleVisitor {
+public:
+ explicit DOMWrapperTracer(Visitor* visitor)
+ : m_visitor(visitor)
+ {
+ }
+
+ virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classId) override
+ {
+ if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInfo::ObjectClassId)
+ return;
+
+ // Casting to a Handle is safe here, since the Persistent doesn't get GCd
+ // during tracing.
+ ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject());
+ v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object>*>(value);
+ ASSERT(V8DOMWrapper::isDOMWrapper(*wrapper));
+ toWrapperTypeInfo(*wrapper)->trace(m_visitor, toScriptWrappableBase(*wrapper));
+ }
+
+private:
+ Visitor* m_visitor;
+};
+
+void V8GCController::traceDOMWrappers(Visitor* visitor)
+{
+ DOMWrapperTracer tracer(visitor);
+ v8::V8::VisitHandlesWithClassIds(&tracer);
haraken 2014/10/15 10:43:04 This is problematic... When doing an Oilpan's GC,
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698