OLD | NEW |
1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
2 | 2 |
3 | 3 |
4 {##############################################################################} | 4 {##############################################################################} |
5 {% block indexed_property_getter %} | 5 {% block indexed_property_getter %} |
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
7 {% set getter = indexed_property_getter %} | 7 {% set getter = indexed_property_getter %} |
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
9 { | 9 { |
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 {% if named_property_getter and named_property_getter.is_enumerable and | 369 {% if named_property_getter and named_property_getter.is_enumerable and |
370 not named_property_getter.is_custom_property_enumerator %} | 370 not named_property_getter.is_custom_property_enumerator %} |
371 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 371 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
372 { | 372 { |
373 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 373 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
374 Vector<String> names; | 374 Vector<String> names; |
375 ExceptionState exceptionState(ExceptionState::EnumerationContext, "{{interfa
ce_name}}", info.Holder(), info.GetIsolate()); | 375 ExceptionState exceptionState(ExceptionState::EnumerationContext, "{{interfa
ce_name}}", info.Holder(), info.GetIsolate()); |
376 impl->namedPropertyEnumerator(names, exceptionState); | 376 impl->namedPropertyEnumerator(names, exceptionState); |
377 if (exceptionState.throwIfNeeded()) | 377 if (exceptionState.throwIfNeeded()) |
378 return; | 378 return; |
379 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 379 v8::Local<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size(
)); |
380 for (size_t i = 0; i < names.size(); ++i) | 380 for (size_t i = 0; i < names.size(); ++i) |
381 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 381 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
382 v8SetReturnValue(info, v8names); | 382 v8SetReturnValue(info, v8names); |
383 } | 383 } |
384 | 384 |
385 {% endif %} | 385 {% endif %} |
386 {% endblock %} | 386 {% endblock %} |
387 | 387 |
388 | 388 |
389 {##############################################################################} | 389 {##############################################################################} |
(...skipping 13 matching lines...) Expand all Loading... |
403 | 403 |
404 {% endif %} | 404 {% endif %} |
405 {% endblock %} | 405 {% endblock %} |
406 | 406 |
407 | 407 |
408 {##############################################################################} | 408 {##############################################################################} |
409 {% block origin_safe_method_setter %} | 409 {% block origin_safe_method_setter %} |
410 {% if has_origin_safe_method_setter %} | 410 {% if has_origin_safe_method_setter %} |
411 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8::
Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | 411 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8::
Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
412 { | 412 { |
413 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i
nfo.This(), info.GetIsolate()); | 413 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); |
414 if (holder.IsEmpty()) | 414 if (holder.IsEmpty()) |
415 return; | 415 return; |
416 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 416 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
417 v8::String::Utf8Value attributeName(name); | 417 v8::String::Utf8Value attributeName(name); |
418 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 418 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
419 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 419 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
420 exceptionState.throwIfNeeded(); | 420 exceptionState.throwIfNeeded(); |
421 return; | 421 return; |
422 } | 422 } |
423 | 423 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 2) Errors cannot be cloned (or serialized): | 559 2) Errors cannot be cloned (or serialized): |
560 http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-in
terfaces.html#safe-passing-of-structured-data #} | 560 http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-in
terfaces.html#safe-passing-of-structured-data #} |
561 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) { | 561 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) { |
562 {% for attribute in any_type_attributes %} | 562 {% for attribute in any_type_attributes %} |
563 if (!{{attribute.name}}.IsEmpty()) | 563 if (!{{attribute.name}}.IsEmpty()) |
564 event->setSerialized{{attribute.name | blink_capitalize}}(Serialized
ScriptValueFactory::instance().createAndSwallowExceptions(info.GetIsolate(), {{a
ttribute.name}})); | 564 event->setSerialized{{attribute.name | blink_capitalize}}(Serialized
ScriptValueFactory::instance().createAndSwallowExceptions(info.GetIsolate(), {{a
ttribute.name}})); |
565 {% endfor %} | 565 {% endfor %} |
566 } | 566 } |
567 | 567 |
568 {% endif %} | 568 {% endif %} |
569 v8::Handle<v8::Object> wrapper = info.Holder(); | 569 v8::Local<v8::Object> wrapper = info.Holder(); |
570 event->associateWithWrapper(info.GetIsolate(), &{{v8_class}}::wrapperTypeInf
o, wrapper); | 570 event->associateWithWrapper(info.GetIsolate(), &{{v8_class}}::wrapperTypeInf
o, wrapper); |
571 v8SetReturnValue(info, wrapper); | 571 v8SetReturnValue(info, wrapper); |
572 } | 572 } |
573 | 573 |
574 {% endif %} | 574 {% endif %} |
575 {% endblock %} | 575 {% endblock %} |
576 | 576 |
577 | 577 |
578 {##############################################################################} | 578 {##############################################################################} |
579 {% block visit_dom_wrapper %} | 579 {% block visit_dom_wrapper %} |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 } | 835 } |
836 | 836 |
837 {% elif is_array_buffer_or_view %} | 837 {% elif is_array_buffer_or_view %} |
838 {{cpp_class}}* {{v8_class}}::toImpl(v8::Handle<v8::Object> object) | 838 {{cpp_class}}* {{v8_class}}::toImpl(v8::Handle<v8::Object> object) |
839 { | 839 { |
840 ASSERT(object->Is{{interface_name}}()); | 840 ASSERT(object->Is{{interface_name}}()); |
841 ScriptWrappable* scriptWrappable = toScriptWrappable(object); | 841 ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
842 if (scriptWrappable) | 842 if (scriptWrappable) |
843 return scriptWrappable->toImpl<{{cpp_class}}>(); | 843 return scriptWrappable->toImpl<{{cpp_class}}>(); |
844 | 844 |
845 v8::Handle<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}
>(); | 845 v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>
(); |
846 RefPtr<{{cpp_class}}> typedArray = {{cpp_class}}::create(V8ArrayBuffer::toIm
pl(v8View->Buffer()), v8View->ByteOffset(), v8View->{% if interface_name == 'Dat
aView' %}Byte{% endif %}Length()); | 846 RefPtr<{{cpp_class}}> typedArray = {{cpp_class}}::create(V8ArrayBuffer::toIm
pl(v8View->Buffer()), v8View->ByteOffset(), v8View->{% if interface_name == 'Dat
aView' %}Byte{% endif %}Length()); |
847 typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrap
perTypeInfo(), object); | 847 typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrap
perTypeInfo(), object); |
848 | 848 |
849 return typedArray->toImpl<{{cpp_class}}>(); | 849 return typedArray->toImpl<{{cpp_class}}>(); |
850 } | 850 } |
851 | 851 |
852 {% endif %} | 852 {% endif %} |
853 {% endblock %} | 853 {% endblock %} |
854 | 854 |
855 | 855 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 901 |
902 {##############################################################################} | 902 {##############################################################################} |
903 {% block get_shadow_object_template %} | 903 {% block get_shadow_object_template %} |
904 {% if interface_name == 'Window' %} | 904 {% if interface_name == 'Window' %} |
905 v8::Handle<v8::ObjectTemplate> V8Window::getShadowObjectTemplate(v8::Isolate* is
olate) | 905 v8::Handle<v8::ObjectTemplate> V8Window::getShadowObjectTemplate(v8::Isolate* is
olate) |
906 { | 906 { |
907 if (DOMWrapperWorld::current(isolate).isMainWorld()) { | 907 if (DOMWrapperWorld::current(isolate).isMainWorld()) { |
908 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForMainWorld, ()); | 908 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForMainWorld, ()); |
909 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) { | 909 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) { |
910 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 910 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
911 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola
te); | 911 v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolat
e); |
912 configureShadowObjectTemplate(templ, isolate); | 912 configureShadowObjectTemplate(templ, isolate); |
913 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ); | 913 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ); |
914 return templ; | 914 return templ; |
915 } | 915 } |
916 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForMainWorld); | 916 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForMainWorld); |
917 } else { | 917 } else { |
918 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForNonMainWorld, ()); | 918 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForNonMainWorld, ()); |
919 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) { | 919 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) { |
920 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 920 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
921 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola
te); | 921 v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolat
e); |
922 configureShadowObjectTemplate(templ, isolate); | 922 configureShadowObjectTemplate(templ, isolate); |
923 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); | 923 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); |
924 return templ; | 924 return templ; |
925 } | 925 } |
926 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForNonMainWorld); | 926 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForNonMainWorld); |
927 } | 927 } |
928 } | 928 } |
929 | 929 |
930 {% endif %} | 930 {% endif %} |
931 {% endblock %} | 931 {% endblock %} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 } | 970 } |
971 | 971 |
972 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 972 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
973 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 973 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
974 { | 974 { |
975 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 975 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
976 } | 976 } |
977 {% endfor %} | 977 {% endfor %} |
978 {% endif %} | 978 {% endif %} |
979 {% endblock %} | 979 {% endblock %} |
OLD | NEW |