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

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
« no previous file with comments | « Source/bindings/core/v8/V8GCController.h ('k') | Source/bindings/core/v8/WindowProxy.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0ffef6a0bcff52f3a90b393f2fdc17ff2730b904 100644
--- a/Source/bindings/core/v8/V8GCController.cpp
+++ b/Source/bindings/core/v8/V8GCController.cpp
@@ -368,14 +368,14 @@ void V8GCController::majorGCPrologue(bool constructRetainedObjectInfos, v8::Isol
{
TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMajorGC");
MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos);
- v8::V8::VisitHandlesWithClassIds(&visitor);
+ v8::V8::VisitHandlesWithClassIds(isolate, &visitor);
visitor.notifyFinished();
}
V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GET_SAMPLING_STATE());
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MajorGC");
} else {
MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos);
- v8::V8::VisitHandlesWithClassIds(&visitor);
+ v8::V8::VisitHandlesWithClassIds(isolate, &visitor);
visitor.notifyFinished();
}
}
@@ -456,4 +456,35 @@ 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));
+ if (m_visitor)
+ toWrapperTypeInfo(*wrapper)->trace(m_visitor, toScriptWrappableBase(*wrapper));
+ }
+
+private:
+ Visitor* m_visitor;
+};
+
+void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor)
+{
+ DOMWrapperTracer tracer(visitor);
+ v8::V8::VisitHandlesWithClassIds(isolate, &tracer);
+}
+
} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/V8GCController.h ('k') | Source/bindings/core/v8/WindowProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698