Chromium Code Reviews| 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 {% set getter_callback = | 6 {% set getter_callback = |
| 7 '%sV8Internal::%sAttributeGetterCallback' % | 7 '%sV8Internal::%sAttributeGetterCallback' % |
| 8 (cpp_class, attribute.name) | 8 (cpp_class, attribute.name) |
| 9 if not attribute.constructor_type else | 9 if not attribute.constructor_type else |
| 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} | 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 123 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, jsValue, info); | 123 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, jsValue, info); |
| 124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 125 } | 125 } |
| 126 | 126 |
| 127 {% endif %} | 127 {% endif %} |
| 128 {% endblock %} | 128 {% endblock %} |
| 129 | 129 |
| 130 | 130 |
| 131 {##############################################################################} | 131 {##############################################################################} |
| 132 {% block overloaded_constructor_callback %} | 132 {% from 'methods.cpp' import named_constructor_callback with context %} |
| 133 {% block named_constructor %} | |
| 134 {% if named_constructor %} | |
| 135 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, 0, 0, 0 , {{v8_class}}::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype } ; | |
| 136 | |
| 137 {{named_constructor_callback(named_constructor)}} | |
| 138 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate, WrapperWorldType currentWorldType) | |
| 139 { | |
| 140 // This is only for getting a unique pointer which we can pass to privateTem plate. | |
| 141 static int privateTemplateUniqueKey; | |
| 142 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 143 v8::Local<v8::FunctionTemplate> result = data->privateTemplateIfExists(curre ntWorldType, &privateTemplateUniqueKey); | |
| 144 if (!result.IsEmpty()) | |
| 145 return result; | |
| 146 | |
| 147 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 148 v8::EscapableHandleScope scope(isolate); | |
| 149 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback) ; | |
| 150 | |
| 151 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); | |
| 152 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount); | |
| 153 result->SetClassName(v8::String::NewFromUtf8(isolate, "{{cpp_class}}", v8::S tring::kInternalizedString)); | |
|
haraken
2013/12/16 08:56:18
v8::String::NewFromUtf8 => v8Symbol (in V8Binding.
Nils Barth (inactive)
2013/12/16 09:29:45
There are 13 cases; will fix in followup.
| |
| 154 result->Inherit({{v8_class}}::domTemplate(isolate, currentWorldType)); | |
| 155 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result ); | |
| 156 | |
| 157 return scope.Escape(result); | |
| 158 } | |
| 159 | |
| 160 {% endif %} | |
| 161 {% endblock %} | |
| 162 | |
| 163 {##############################################################################} | |
| 164 {% block overloaded_constructor %} | |
| 133 {% if constructors|length > 1 %} | 165 {% if constructors|length > 1 %} |
| 134 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 166 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 135 { | 167 { |
| 136 {% for constructor in constructors %} | 168 {% for constructor in constructors %} |
| 137 if ({{constructor.overload_resolution_expression}}) { | 169 if ({{constructor.overload_resolution_expression}}) { |
| 138 {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info) ; | 170 {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info) ; |
| 139 return; | 171 return; |
| 140 } | 172 } |
| 141 {% endfor %} | 173 {% endfor %} |
| 142 {% if interface_length %} | 174 {% if interface_length %} |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 fromInternalPointer(object)->deref(); | 711 fromInternalPointer(object)->deref(); |
| 680 } | 712 } |
| 681 | 713 |
| 682 template<> | 714 template<> |
| 683 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) | 715 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) |
| 684 { | 716 { |
| 685 return toV8(impl, creationContext, isolate); | 717 return toV8(impl, creationContext, isolate); |
| 686 } | 718 } |
| 687 | 719 |
| 688 {% endblock %} | 720 {% endblock %} |
| OLD | NEW |