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

Unified Diff: Source/bindings/templates/interface.h

Issue 456683002: bindings: Introduces type-check for the internal pointers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Source/bindings/templates/interface.h
diff --git a/Source/bindings/templates/interface.h b/Source/bindings/templates/interface.h
index 17b1f971efde2c8dc08e4a7faffa96c6764b23e9..3a908e1d8b1330c01ad69a4fbc29ade7393d61ca 100644
--- a/Source/bindings/templates/interface.h
+++ b/Source/bindings/templates/interface.h
@@ -32,13 +32,13 @@ public:
static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
static {{cpp_class}}* toNative(v8::Handle<v8::Object> object)
{
- return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(blink::toInternalPointer(object));
haraken 2014/08/08 09:37:23 Do we need blink:: ? The same comment for other pa
Yuki 2014/08/08 13:01:25 Yes, we need blink:: to solve ambiguity between bl
}
static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
static const WrapperTypeInfo wrapperTypeInfo;
- static void derefObject(void*);
+ static void derefObject(ScriptWrappableBase* internalPointer);
haraken 2014/08/08 09:37:23 Omit |internalPointer|. Blink normally doesn't add
Yuki 2014/08/08 13:01:25 I read the style guide at http://dev.chromium.org/
haraken 2014/08/08 13:14:30 I think the issue is we're using a word "internalP
{% if has_visit_dom_wrapper %}
- static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Isolate*);
+ static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8::Persistent<v8::Object>&, v8::Isolate*);
{% endif %}
{% if is_active_dom_object %}
static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
@@ -140,21 +140,21 @@ public:
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + {{custom_internal_field_counter}};
{% endif %}
{# End custom internal fields #}
- static inline void* toInternalPointer({{cpp_class}}* impl)
+ static inline ScriptWrappableBase* toInternalPointer({{cpp_class}}* impl)
{
{% if parent_interface %}
return V8{{parent_interface}}::toInternalPointer(impl);
{% else %}
- return impl;
+ return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
haraken 2014/08/08 09:37:23 Do we need static_cast<void*> ? The same comment f
Yuki 2014/08/08 13:01:25 The other parts really need this trick because the
{% endif %}
}
- static inline {{cpp_class}}* fromInternalPointer(void* object)
+ static inline {{cpp_class}}* fromInternalPointer(ScriptWrappableBase* internalPointer)
{
{% if parent_interface %}
- return static_cast<{{cpp_class}}*>(V8{{parent_interface}}::fromInternalPointer(object));
+ return static_cast<{{cpp_class}}*>(V8{{parent_interface}}::fromInternalPointer(internalPointer));
{% else %}
- return static_cast<{{cpp_class}}*>(object);
+ return reinterpret_cast<{{cpp_class}}*>(static_cast<void*>(internalPointer));
{% endif %}
}
{% if interface_name == 'Window' %}

Powered by Google App Engine
This is Rietveld 408576698