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

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

Issue 176963017: Remove WrapperWorldType from V8 binding (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 'dispatchEvent'] %} 10 'dispatchEvent'] %}
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 {% endfilter %} 310 {% endfilter %}
311 {% endmacro %} 311 {% endmacro %}
312 312
313 313
314 {##############################################################################} 314 {##############################################################################}
315 {% macro origin_safe_method_getter(method, world_suffix) %} 315 {% macro origin_safe_method_getter(method, world_suffix) %}
316 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) 316 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info)
317 { 317 {
318 {% set signature = 'v8::Local<v8::Signature>()' 318 {% set signature = 'v8::Local<v8::Signature>()'
319 if method.is_do_not_check_signature else 319 if method.is_do_not_check_signature else
320 'v8::Signature::New(info.GetIsolate(), %s::domTemplate(in fo.GetIsolate(), currentWorldType))' % v8_class %} 320 'v8::Signature::New(info.GetIsolate(), %s::domTemplate(in fo.GetIsolate()))' % v8_class %}
321 {# FIXME: don't call GetIsolate() so often #} 321 {# FIXME: don't call GetIsolate() so often #}
322 static int domTemplateKey; // This address is used for a key to look up the dom template. 322 static int domTemplateKey; // This address is used for a key to look up the dom template.
323 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
324 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 323 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
325 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #} 324 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #}
326 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(current WorldType, &domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallba ck{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or _variadic_arguments}}); 325 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem plateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}} , v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_argument s}});
327 326
328 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), info.GetIsolate()); 327 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), info.GetIsolate());
329 if (holder.IsEmpty()) { 328 if (holder.IsEmpty()) {
330 // This is only reachable via |object.__proto__.func|, in which case it 329 // This is only reachable via |object.__proto__.func|, in which case it
331 // has already passed the same origin security check 330 // has already passed the same origin security check
332 v8SetReturnValue(info, privateTemplate->GetFunction()); 331 v8SetReturnValue(info, privateTemplate->GetFunction());
333 return; 332 return;
334 } 333 }
335 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); 334 {{cpp_class}}* imp = {{v8_class}}::toNative(holder);
336 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), imp->frame (), DoNotReportSecurityError)) { 335 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), imp->frame (), DoNotReportSecurityError)) {
337 static int sharedTemplateKey; // This address is used for a key to look up the dom template. 336 static int sharedTemplateKey; // This address is used for a key to look up the dom template.
338 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(curr entWorldType, &sharedTemplateKey, {{cpp_class}}V8Internal::{{method.name}}Method Callback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_of_requi red_or_variadic_arguments}}); 337 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha redTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_su ffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_ar guments}});
339 v8SetReturnValue(info, sharedTemplate->GetFunction()); 338 v8SetReturnValue(info, sharedTemplate->GetFunction());
340 return; 339 return;
341 } 340 }
342 341
343 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "{{method.name}}")); 342 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "{{method.name}}"));
344 if (!hiddenValue.IsEmpty()) { 343 if (!hiddenValue.IsEmpty()) {
345 v8SetReturnValue(info, hiddenValue); 344 v8SetReturnValue(info, hiddenValue);
346 return; 345 return;
347 } 346 }
348 347
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 v8::Handle<v8::Object> wrapper = info.Holder(); 436 v8::Handle<v8::Object> wrapper = info.Holder();
438 {% if is_constructor_raises_exception %} 437 {% if is_constructor_raises_exception %}
439 if (exceptionState.throwIfNeeded()) 438 if (exceptionState.throwIfNeeded())
440 return; 439 return;
441 {% endif %} 440 {% endif %}
442 441
443 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent); 442 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent);
444 v8SetReturnValue(info, wrapper); 443 v8SetReturnValue(info, wrapper);
445 } 444 }
446 {% endmacro %} 445 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/results/V8SVGTestInterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698