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

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

Issue 670483003: Remove an unnecessary reinterpret_cast from a persistent to an handle (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 | « no previous file | Source/bindings/core/v8/WrapperTypeInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptProfiler.cpp
diff --git a/Source/bindings/core/v8/ScriptProfiler.cpp b/Source/bindings/core/v8/ScriptProfiler.cpp
index efe29453f19ab2c6557384607e6c7e9209f6b284..35137e816159c9dd1059b8fbb83f837207953b80 100644
--- a/Source/bindings/core/v8/ScriptProfiler.cpp
+++ b/Source/bindings/core/v8/ScriptProfiler.cpp
@@ -270,7 +270,9 @@ void ScriptProfiler::visitNodeWrappers(WrappedNodeVisitor* visitor)
public:
DOMNodeWrapperVisitor(WrappedNodeVisitor* visitor, v8::Isolate* isolate)
: m_visitor(visitor)
+#if ENABLE(ASSERT)
, m_isolate(isolate)
+#endif
{
}
@@ -278,17 +280,23 @@ void ScriptProfiler::visitNodeWrappers(WrappedNodeVisitor* visitor)
{
if (classId != WrapperTypeInfo::NodeClassId)
return;
- // Casting to Handle is safe here, since the Persistent cannot get
- // GCd during visiting.
- v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object>*>(value);
- ASSERT_UNUSED(m_isolate, V8Node::hasInstance(*wrapper, m_isolate));
- ASSERT((*wrapper)->IsObject());
- m_visitor->visitNode(V8Node::toImpl(*wrapper));
+
+#if ENABLE(ASSERT)
+ {
+ v8::HandleScope scope(m_isolate);
+ v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8::Persistent<v8::Object>::Cast(*value));
+ ASSERT(V8Node::hasInstance(wrapper, m_isolate));
+ ASSERT(wrapper->IsObject());
+ }
+#endif
+ m_visitor->visitNode(toScriptWrappableBase(v8::Persistent<v8::Object>::Cast(*value))->toImpl<Node>());
}
private:
WrappedNodeVisitor* m_visitor;
+#if ENABLE(ASSERT)
v8::Isolate* m_isolate;
+#endif
} wrapperVisitor(visitor, isolate);
v8::V8::VisitHandlesWithClassIds(isolate, &wrapperVisitor);
« no previous file with comments | « no previous file | Source/bindings/core/v8/WrapperTypeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698