| OLD | NEW |
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro attribute_configuration(attribute) %} | 5 {% macro attribute_configuration(attribute) %} |
| 6 {"{{attribute.name}}", {{attribute.getter_callback_name}}, {{attribute.setter_ca
llback_name}}, {{attribute.getter_callback_name_for_main_world}}, {{attribute.se
tter_callback_name_for_main_world}}, {{attribute.wrapper_type_info}}, static_cas
t<v8::AccessControl>({{attribute.access_control_list | join(' | ')}}), static_ca
st<v8::PropertyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /*
on instance */}{% endmacro %} | 6 {"{{attribute.name}}", {{attribute.getter_callback_name}}, {{attribute.setter_ca
llback_name}}, {{attribute.getter_callback_name_for_main_world}}, {{attribute.se
tter_callback_name_for_main_world}}, {{attribute.wrapper_type_info}}, static_cas
t<v8::AccessControl>({{attribute.access_control_list | join(' | ')}}), static_ca
st<v8::PropertyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /*
on instance */}{% endmacro %} |
| 7 | 7 |
| 8 | 8 |
| 9 {##############################################################################} | 9 {##############################################################################} |
| 10 {% block constructor_getter %} | 10 {% block constructor_getter %} |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 {% endif %} | 128 {% endif %} |
| 129 {% endmacro %} | 129 {% endmacro %} |
| 130 | 130 |
| 131 | 131 |
| 132 {##############################################################################} | 132 {##############################################################################} |
| 133 {% block get_template %} | 133 {% block get_template %} |
| 134 {# FIXME: rename to get_dom_template and GetDOMTemplate #} | 134 {# FIXME: rename to get_dom_template and GetDOMTemplate #} |
| 135 v8::Handle<v8::FunctionTemplate> {{v8_class_name}}::GetTemplate(v8::Isolate* iso
late, WrapperWorldType currentWorldType) | 135 v8::Handle<v8::FunctionTemplate> {{v8_class_name}}::GetTemplate(v8::Isolate* iso
late, WrapperWorldType currentWorldType) |
| 136 { | 136 { |
| 137 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 137 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 138 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 138 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 139 if (result != data->templateMap(currentWorldType).end()) | 139 if (result != data->templateMap(currentWorldType).end()) |
| 140 return result->value.newLocal(isolate); | 140 return result->value.newLocal(isolate); |
| 141 | 141 |
| 142 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 142 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 143 v8::HandleScope handleScope(isolate); | 143 v8::HandleScope handleScope(isolate); |
| 144 v8::Handle<v8::FunctionTemplate> templ = | 144 v8::Handle<v8::FunctionTemplate> templ = |
| 145 Configure{{v8_class_name}}Template(data->rawTemplate(&info, currentWorld
Type), isolate, currentWorldType); | 145 Configure{{v8_class_name}}Template(data->rawTemplate(&wrapperTypeInfo, c
urrentWorldType), isolate, currentWorldType); |
| 146 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 146 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 147 return handleScope.Close(templ); | 147 return handleScope.Close(templ); |
| 148 } | 148 } |
| 149 | 149 |
| 150 {% endblock %} | 150 {% endblock %} |
| 151 | 151 |
| 152 | 152 |
| 153 {##############################################################################} | 153 {##############################################################################} |
| 154 {% block has_instance_and_has_instance_in_any_world %} | 154 {% block has_instance_and_has_instance_in_any_world %} |
| 155 bool {{v8_class_name}}::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 155 bool {{v8_class_name}}::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate, WrapperWorldType currentWorldType) |
| 156 { | 156 { |
| 157 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 157 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool {{v8_class_name}}::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) | 160 bool {{v8_class_name}}::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) |
| 161 { | 161 { |
| 162 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 162 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 163 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 163 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 164 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 164 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 165 } | 165 } |
| 166 | 166 |
| 167 {% endblock %} | 167 {% endblock %} |
| 168 | 168 |
| 169 | 169 |
| 170 {##############################################################################} | 170 {##############################################################################} |
| 171 {% block install_per_context_attributes %} | 171 {% block install_per_context_attributes %} |
| 172 {% if has_per_context_enabled_attributes %} | 172 {% if has_per_context_enabled_attributes %} |
| 173 void {{v8_class_name}}::installPerContextEnabledProperties(v8::Handle<v8::Object
> instance, {{cpp_class_name}}* impl, v8::Isolate* isolate) | 173 void {{v8_class_name}}::installPerContextEnabledProperties(v8::Handle<v8::Object
> instance, {{cpp_class_name}}* impl, v8::Isolate* isolate) |
| 174 { | 174 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 187 | 187 |
| 188 | 188 |
| 189 {##############################################################################} | 189 {##############################################################################} |
| 190 {% block create_wrapper_and_deref_object %} | 190 {% block create_wrapper_and_deref_object %} |
| 191 v8::Handle<v8::Object> {{v8_class_name}}::createWrapper(PassRefPtr<{{cpp_class_n
ame}}> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 191 v8::Handle<v8::Object> {{v8_class_name}}::createWrapper(PassRefPtr<{{cpp_class_n
ame}}> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 192 { | 192 { |
| 193 ASSERT(impl); | 193 ASSERT(impl); |
| 194 ASSERT(!DOMDataStore::containsWrapper<{{v8_class_name}}>(impl.get(), isolate
)); | 194 ASSERT(!DOMDataStore::containsWrapper<{{v8_class_name}}>(impl.get(), isolate
)); |
| 195 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 195 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 196 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 196 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 197 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 197 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 198 // the same object de-ref functions, though, so use that as the basis of
the check. | 198 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 199 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 199 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 200 } | 200 } |
| 201 | 201 |
| 202 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 202 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 203 if (UNLIKELY(wrapper.IsEmpty())) | 203 if (UNLIKELY(wrapper.IsEmpty())) |
| 204 return wrapper; | 204 return wrapper; |
| 205 | 205 |
| 206 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 206 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 207 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra
pper, isolate, WrapperConfiguration::Independent); | 207 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &wrapperTy
peInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 208 return wrapper; | 208 return wrapper; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void {{v8_class_name}}::derefObject(void* object) | 211 void {{v8_class_name}}::derefObject(void* object) |
| 212 { | 212 { |
| 213 fromInternalPointer(object)->deref(); | 213 fromInternalPointer(object)->deref(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 {% endblock %} | 216 {% endblock %} |
| OLD | NEW |