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

Side by Side Diff: Source/bindings/templates/methods.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
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if method.has_exception_state %} 6 {% if method.has_exception_state %}
7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
8 {% endif %} 8 {% endif %}
9 {% if method.name in ['addEventListener', 'removeEventListener'] %} 9 {% if method.name in ['addEventListener', 'removeEventListener'] %}
10 {{add_remove_event_listener_method(method.name) | indent}} 10 {{add_remove_event_listener_method(method.name) | indent}}
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return; 264 return;
265 } 265 }
266 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); 266 {{cpp_class}}* imp = {{v8_class}}::toNative(holder);
267 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 267 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
268 static int sharedTemplateUniqueKey; 268 static int sharedTemplateUniqueKey;
269 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, {{cpp_class}}V8Internal::{{method.na me}}MethodCallback{{world_suffix}}, v8Undefined(), v8::Signature::New(info.GetIs olate(), {{v8_class}}::domTemplate(info.GetIsolate(), currentWorldType)), {{meth od.number_of_required_or_variadic_arguments}}); 269 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, {{cpp_class}}V8Internal::{{method.na me}}MethodCallback{{world_suffix}}, v8Undefined(), v8::Signature::New(info.GetIs olate(), {{v8_class}}::domTemplate(info.GetIsolate(), currentWorldType)), {{meth od.number_of_required_or_variadic_arguments}});
270 v8SetReturnValue(info, sharedTemplate->GetFunction()); 270 v8SetReturnValue(info, sharedTemplate->GetFunction());
271 return; 271 return;
272 } 272 }
273 273
274 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "{{method.name}}", v8::String::kInternalizedString )); 274 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "{{method.name}}"));
275 if (!hiddenValue.IsEmpty()) { 275 if (!hiddenValue.IsEmpty()) {
276 v8SetReturnValue(info, hiddenValue); 276 v8SetReturnValue(info, hiddenValue);
277 return; 277 return;
278 } 278 }
279 279
280 v8SetReturnValue(info, privateTemplate->GetFunction()); 280 v8SetReturnValue(info, privateTemplate->GetFunction());
281 } 281 }
282 282
283 static void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Lo cal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 283 static void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Lo cal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
284 { 284 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 v8::Handle<v8::Object> wrapper = info.Holder(); 368 v8::Handle<v8::Object> wrapper = info.Holder();
369 {% if is_constructor_raises_exception %} 369 {% if is_constructor_raises_exception %}
370 if (exceptionState.throwIfNeeded()) 370 if (exceptionState.throwIfNeeded())
371 return; 371 return;
372 {% endif %} 372 {% endif %}
373 373
374 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent); 374 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent);
375 v8SetReturnValue(info, wrapper); 375 v8SetReturnValue(info, wrapper);
376 } 376 }
377 {% endmacro %} 377 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/results/V8SupportTestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698