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

Side by Side Diff: Source/bindings/templates/attributes.cpp

Issue 116983005: Use v8AtomicString instead of v8::String::NewFromUtf8 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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/code_generator_v8.pm ('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 {##############################################################################} 1 {##############################################################################}
2 {% macro attribute_getter(attribute, world_suffix) %} 2 {% macro attribute_getter(attribute, world_suffix) %}
3 {% filter conditional(attribute.conditional_string) %} 3 {% filter conditional(attribute.conditional_string) %}
4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
5 {%- if attribute.is_expose_js_accessors %} 5 {%- if attribute.is_expose_js_accessors %}
6 const v8::FunctionCallbackInfo<v8::Value>& info 6 const v8::FunctionCallbackInfo<v8::Value>& info
7 {%- else %} 7 {%- else %}
8 const v8::PropertyCallbackInfo<v8::Value>& info 8 const v8::PropertyCallbackInfo<v8::Value>& info
9 {%- endif %}) 9 {%- endif %})
10 { 10 {
11 {% if attribute.is_unforgeable %} 11 {% if attribute.is_unforgeable %}
12 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class}}::domTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); 12 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class}}::domTemplate(info.GetIsolate(), worldType(info.GetIsolate())));
13 if (holder.IsEmpty()) 13 if (holder.IsEmpty())
14 return; 14 return;
15 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); 15 {{cpp_class}}* imp = {{v8_class}}::toNative(holder);
16 {% endif %} 16 {% endif %}
17 {% if attribute.cached_attribute_validation_method %} 17 {% if attribute.cached_attribute_validation_method %}
18 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat e(), "{{attribute.name}}", v8::String::kInternalizedString); 18 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{a ttribute.name}}");
19 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 19 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
20 if (!imp->{{attribute.cached_attribute_validation_method}}()) { 20 if (!imp->{{attribute.cached_attribute_validation_method}}()) {
21 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me); 21 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me);
22 if (!jsValue.IsEmpty()) { 22 if (!jsValue.IsEmpty()) {
23 v8SetReturnValue(info, jsValue); 23 v8SetReturnValue(info, jsValue);
24 return; 24 return;
25 } 25 }
26 } 26 }
27 {% elif not (attribute.is_static or attribute.is_unforgeable) %} 27 {% elif not (attribute.is_static or attribute.is_unforgeable) %}
28 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 28 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 159 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
160 {% endif %} 160 {% endif %}
161 {% if attribute.is_call_with_execution_context %} 161 {% if attribute.is_call_with_execution_context %}
162 ExecutionContext* scriptContext = getExecutionContext(); 162 ExecutionContext* scriptContext = getExecutionContext();
163 {% endif %} 163 {% endif %}
164 {{attribute.cpp_setter}}; 164 {{attribute.cpp_setter}};
165 {% if attribute.is_setter_raises_exception %} 165 {% if attribute.is_setter_raises_exception %}
166 exceptionState.throwIfNeeded(); 166 exceptionState.throwIfNeeded();
167 {% endif %} 167 {% endif %}
168 {% if attribute.cached_attribute_validation_method %} 168 {% if attribute.cached_attribute_validation_method %}
169 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(), "{{attribute.name}}", v8::String::kInternalizedString)); // Invalidate the cache d value. 169 info.Holder()->DeleteHiddenValue(v8AtomicString(info.GetIsolate(), "{{attrib ute.name}}")); // Invalidate the cached value.
170 {% endif %} 170 {% endif %}
171 } 171 }
172 {% endfilter %} 172 {% endfilter %}
173 {% endmacro %} 173 {% endmacro %}
174 174
175 175
176 {##############################################################################} 176 {##############################################################################}
177 {% macro attribute_setter_callback(attribute, world_suffix) %} 177 {% macro attribute_setter_callback(attribute, world_suffix) %}
178 {% filter conditional(attribute.conditional_string) %} 178 {% filter conditional(attribute.conditional_string) %}
179 static void {{attribute.name}}AttributeSetterCallback{{world_suffix}}( 179 static void {{attribute.name}}AttributeSetterCallback{{world_suffix}}(
(...skipping 25 matching lines...) Expand all
205 {% endif %} 205 {% endif %}
206 {% if attribute.has_custom_setter %} 206 {% if attribute.has_custom_setter %}
207 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); 207 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info);
208 {% else %} 208 {% else %}
209 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j sValue, info); 209 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j sValue, info);
210 {% endif %} 210 {% endif %}
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
212 } 212 }
213 {% endfilter %} 213 {% endfilter %}
214 {% endmacro %} 214 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698