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

Side by Side 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: Synced. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #ifndef {{v8_class}}_h 7 #ifndef {{v8_class}}_h
8 #define {{v8_class}}_h 8 #define {{v8_class}}_h
9 9
10 {% filter conditional(conditional_string) %} 10 {% filter conditional(conditional_string) %}
(...skipping 29 matching lines...) Expand all
40 {% endif %} 40 {% endif %}
41 {% endfor %} 41 {% endfor %}
42 }; 42 };
43 43
44 {% endif %} 44 {% endif %}
45 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); 45 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
46 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va lue>, v8::Isolate*); 46 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va lue>, v8::Isolate*);
47 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); 47 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
48 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object) 48 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object)
49 { 49 {
50 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8 DOMWrapperObjectIndex)); 50 return fromInternalPointer(blink::toInternalPointer(object));
51 } 51 }
52 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val ue>); 52 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val ue>);
53 static const WrapperTypeInfo wrapperTypeInfo; 53 static const WrapperTypeInfo wrapperTypeInfo;
54 static void derefObject(void*); 54 static void derefObject(ScriptWrappableBase* internalPointer);
55 {% if has_visit_dom_wrapper %} 55 {% if has_visit_dom_wrapper %}
56 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is olate*); 56 static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8:: Persistent<v8::Object>&, v8::Isolate*);
57 {% endif %} 57 {% endif %}
58 {% if is_active_dom_object %} 58 {% if is_active_dom_object %}
59 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); 59 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
60 {% endif %} 60 {% endif %}
61 {% if is_event_target %} 61 {% if is_event_target %}
62 static EventTarget* toEventTarget(v8::Handle<v8::Object>); 62 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
63 {% endif %} 63 {% endif %}
64 {% if interface_name == 'Window' %} 64 {% if interface_name == 'Window' %}
65 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*); 65 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*);
66 {% endif %} 66 {% endif %}
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 #if ENABLE(OILPAN) 139 #if ENABLE(OILPAN)
140 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + {{custom_internal_field_counter}}; 140 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + {{custom_internal_field_counter}};
141 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}} + 1; 141 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}} + 1;
142 #else 142 #else
143 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}}; 143 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}};
144 #endif 144 #endif
145 {% else %} 145 {% else %}
146 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}}; 146 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}};
147 {% endif %} 147 {% endif %}
148 {# End custom internal fields #} 148 {# End custom internal fields #}
149 static inline void* toInternalPointer({{cpp_class}}* impl) 149 static inline ScriptWrappableBase* toInternalPointer({{cpp_class}}* impl)
150 { 150 {
151 {% if parent_interface %} 151 {% if parent_interface %}
152 return V8{{parent_interface}}::toInternalPointer(impl); 152 return V8{{parent_interface}}::toInternalPointer(impl);
153 {% else %} 153 {% else %}
154 return impl; 154 return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
155 {% endif %} 155 {% endif %}
156 } 156 }
157 157
158 static inline {{cpp_class}}* fromInternalPointer(void* object) 158 static inline {{cpp_class}}* fromInternalPointer(ScriptWrappableBase* intern alPointer)
159 { 159 {
160 {% if parent_interface %} 160 {% if parent_interface %}
161 return static_cast<{{cpp_class}}*>(V8{{parent_interface}}::fromInternalP ointer(object)); 161 return static_cast<{{cpp_class}}*>(V8{{parent_interface}}::fromInternalP ointer(internalPointer));
162 {% else %} 162 {% else %}
163 return static_cast<{{cpp_class}}*>(object); 163 return reinterpret_cast<{{cpp_class}}*>(static_cast<void*>(internalPoint er));
164 {% endif %} 164 {% endif %}
165 } 165 }
166 {% if interface_name == 'Window' %} 166 {% if interface_name == 'Window' %}
167 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data); 167 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
168 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); 168 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data);
169 {% endif %} 169 {% endif %}
170 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, {{cpp _class}}*, v8::Isolate*){% if has_per_context_enabled_attributes %}; 170 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, {{cpp _class}}*, v8::Isolate*){% if has_per_context_enabled_attributes %};
171 {% else %} { } 171 {% else %} { }
172 {% endif %} 172 {% endif %}
173 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol ate*){% if per_context_enabled_methods %}; 173 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol ate*){% if per_context_enabled_methods %};
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); 293 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
294 } 294 }
295 295
296 {% if has_event_constructor %} 296 {% if has_event_constructor %}
297 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = ""); 297 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = "");
298 298
299 {% endif %} 299 {% endif %}
300 } 300 }
301 {% endfilter %} 301 {% endfilter %}
302 #endif // {{v8_class}}_h 302 #endif // {{v8_class}}_h
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698