OLD | NEW |
---|---|
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 14 matching lines...) Expand all Loading... | |
25 }; | 25 }; |
26 | 26 |
27 {% endif %} | 27 {% endif %} |
28 class {{v8_class}} { | 28 class {{v8_class}} { |
29 public: | 29 public: |
30 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); | 30 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); |
31 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va lue>, v8::Isolate*); | 31 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va lue>, v8::Isolate*); |
32 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); | 32 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); |
33 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object) | 33 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object) |
34 { | 34 { |
35 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8 DOMWrapperObjectIndex)); | 35 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
| |
36 } | 36 } |
37 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val ue>); | 37 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val ue>); |
38 static const WrapperTypeInfo wrapperTypeInfo; | 38 static const WrapperTypeInfo wrapperTypeInfo; |
39 static void derefObject(void*); | 39 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
| |
40 {% if has_visit_dom_wrapper %} | 40 {% if has_visit_dom_wrapper %} |
41 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is olate*); | 41 static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8:: Persistent<v8::Object>&, v8::Isolate*); |
42 {% endif %} | 42 {% endif %} |
43 {% if is_active_dom_object %} | 43 {% if is_active_dom_object %} |
44 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); | 44 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); |
45 {% endif %} | 45 {% endif %} |
46 {% if is_event_target %} | 46 {% if is_event_target %} |
47 static EventTarget* toEventTarget(v8::Handle<v8::Object>); | 47 static EventTarget* toEventTarget(v8::Handle<v8::Object>); |
48 {% endif %} | 48 {% endif %} |
49 {% if interface_name == 'Window' %} | 49 {% if interface_name == 'Window' %} |
50 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*); | 50 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*); |
51 {% endif %} | 51 {% endif %} |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 #if ENABLE(OILPAN) | 133 #if ENABLE(OILPAN) |
134 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + {{custom_internal_field_counter}}; | 134 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + {{custom_internal_field_counter}}; |
135 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}} + 1; | 135 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}} + 1; |
136 #else | 136 #else |
137 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}}; | 137 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}}; |
138 #endif | 138 #endif |
139 {% else %} | 139 {% else %} |
140 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}}; | 140 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}}; |
141 {% endif %} | 141 {% endif %} |
142 {# End custom internal fields #} | 142 {# End custom internal fields #} |
143 static inline void* toInternalPointer({{cpp_class}}* impl) | 143 static inline ScriptWrappableBase* toInternalPointer({{cpp_class}}* impl) |
144 { | 144 { |
145 {% if parent_interface %} | 145 {% if parent_interface %} |
146 return V8{{parent_interface}}::toInternalPointer(impl); | 146 return V8{{parent_interface}}::toInternalPointer(impl); |
147 {% else %} | 147 {% else %} |
148 return impl; | 148 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
| |
149 {% endif %} | 149 {% endif %} |
150 } | 150 } |
151 | 151 |
152 static inline {{cpp_class}}* fromInternalPointer(void* object) | 152 static inline {{cpp_class}}* fromInternalPointer(ScriptWrappableBase* intern alPointer) |
153 { | 153 { |
154 {% if parent_interface %} | 154 {% if parent_interface %} |
155 return static_cast<{{cpp_class}}*>(V8{{parent_interface}}::fromInternalP ointer(object)); | 155 return static_cast<{{cpp_class}}*>(V8{{parent_interface}}::fromInternalP ointer(internalPointer)); |
156 {% else %} | 156 {% else %} |
157 return static_cast<{{cpp_class}}*>(object); | 157 return reinterpret_cast<{{cpp_class}}*>(static_cast<void*>(internalPoint er)); |
158 {% endif %} | 158 {% endif %} |
159 } | 159 } |
160 {% if interface_name == 'Window' %} | 160 {% if interface_name == 'Window' %} |
161 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data); | 161 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data); |
162 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); | 162 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); |
163 {% endif %} | 163 {% endif %} |
164 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, {{cpp _class}}*, v8::Isolate*){% if has_per_context_enabled_attributes %}; | 164 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, {{cpp _class}}*, v8::Isolate*){% if has_per_context_enabled_attributes %}; |
165 {% else %} { } | 165 {% else %} { } |
166 {% endif %} | 166 {% endif %} |
167 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol ate*){% if per_context_enabled_methods %}; | 167 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 Loading... | |
287 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 287 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
288 } | 288 } |
289 | 289 |
290 {% if has_event_constructor %} | 290 {% if has_event_constructor %} |
291 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = ""); | 291 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = ""); |
292 | 292 |
293 {% endif %} | 293 {% endif %} |
294 } | 294 } |
295 {% endfilter %} | 295 {% endfilter %} |
296 #endif // {{v8_class}}_h | 296 #endif // {{v8_class}}_h |
OLD | NEW |