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

Side by Side Diff: Source/build/scripts/templates/ElementWrapperFactory.cpp.tmpl

Issue 60763002: Never create HTMLTrackElement when VideoTrack is not enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: consistency Created 7 years, 1 month 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
OLDNEW
1 {% from "macros.tmpl" import license -%} 1 {% from "macros.tmpl" import license -%}
2 {{ license() }} 2 {{ license() }}
3 3
4 #include "config.h" 4 #include "config.h"
5 #include "V8{{namespace}}ElementWrapperFactory.h" 5 #include "V8{{namespace}}ElementWrapperFactory.h"
6 6
7 #include "RuntimeEnabledFeatures.h" 7 #include "RuntimeEnabledFeatures.h"
8 #include "{{namespace}}Names.h" 8 #include "{{namespace}}Names.h"
9 #include "bindings/v8/CustomElementWrapper.h" 9 #include "bindings/v8/CustomElementWrapper.h"
10 {%- for tag in tags|sort if tag.has_js_interface %} 10 {%- for tag in tags|sort if tag.has_js_interface %}
(...skipping 16 matching lines...) Expand all
27 27
28 static v8::Handle<v8::Object> create{{namespace}}ElementWrapper({{namespace}}Ele ment*, v8::Handle<v8::Object>, v8::Isolate*) 28 static v8::Handle<v8::Object> create{{namespace}}ElementWrapper({{namespace}}Ele ment*, v8::Handle<v8::Object>, v8::Isolate*)
29 { 29 {
30 ASSERT_NOT_REACHED(); 30 ASSERT_NOT_REACHED();
31 return v8::Handle<v8::Object>(); 31 return v8::Handle<v8::Object>();
32 } 32 }
33 33
34 {%- for js_interface, list in tags|sort|selectattr('has_js_interface')|groupby(' js_interface') %} 34 {%- for js_interface, list in tags|sort|selectattr('has_js_interface')|groupby(' js_interface') %}
35 static v8::Handle<v8::Object> create{{js_interface}}Wrapper({{namespace}}Element * element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 35 static v8::Handle<v8::Object> create{{js_interface}}Wrapper({{namespace}}Element * element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
36 { 36 {
37 {%- if list[0].wrapperOnlyIfMediaIsAvailable %} 37 {%- if list[0].contextConditional %}
38 Settings* settings = element->document().settings(); 38 if (!ContextFeatures::{{list[0].contextConditional}}Enabled(&element->docume nt()))
39 if (!RuntimeEnabledFeatures::mediaEnabled() || (settings && !settings->media Enabled()))
40 return createV8{{namespace}}FallbackWrapper(to{{fallback_js_interface}}( element), creationContext, isolate); 39 return createV8{{namespace}}FallbackWrapper(to{{fallback_js_interface}}( element), creationContext, isolate);
41 {%- endif %} 40 {%- endif %}
42 {%- if list[0].contextConditional %} 41 {%- if list[0].runtimeEnabled %}
43 if (!ContextFeatures::{{list[0].contextConditional}}Enabled(&element->docume nt())) 42 if (!RuntimeEnabledFeatures::{{list[0].runtimeEnabled}}Enabled())
44 return createV8{{namespace}}FallbackWrapper(to{{fallback_js_interface}}( element), creationContext, isolate); 43 return createV8{{namespace}}FallbackWrapper(to{{fallback_js_interface}}( element), creationContext, isolate);
45 {%- endif %} 44 {%- endif %}
46 return wrap(static_cast<{{js_interface}}*>(element), creationContext, isolat e); 45 return wrap(static_cast<{{js_interface}}*>(element), creationContext, isolat e);
47 } 46 }
48 {%- endfor %} 47 {%- endfor %}
49 48
50 v8::Handle<v8::Object> createV8{{namespace}}Wrapper({{namespace}}Element* elemen t, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 49 v8::Handle<v8::Object> createV8{{namespace}}Wrapper({{namespace}}Element* elemen t, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
51 { 50 {
52 typedef HashMap<StringImpl*, Create{{namespace}}ElementWrapperFunction> Func tionMap; 51 typedef HashMap<StringImpl*, Create{{namespace}}ElementWrapperFunction> Func tionMap;
53 DEFINE_STATIC_LOCAL(FunctionMap, map, ()); 52 DEFINE_STATIC_LOCAL(FunctionMap, map, ());
54 if (map.isEmpty()) { 53 if (map.isEmpty()) {
55 {%- for tag in tags|sort %} 54 {%- for tag in tags|sort %}
56 map.set({{tag|symbol}}Tag.localName().impl(), create{{tag.js_interface}} Wrapper); 55 map.set({{tag|symbol}}Tag.localName().impl(), create{{tag.js_interface}} Wrapper);
57 {%- endfor %} 56 {%- endfor %}
58 } // taco 57 }
59 58
60 Create{{namespace}}ElementWrapperFunction createWrapperFunction = map.get(el ement->localName().impl()); 59 Create{{namespace}}ElementWrapperFunction createWrapperFunction = map.get(el ement->localName().impl());
61 if (createWrapperFunction == create{{namespace}}ElementWrapper) 60 if (createWrapperFunction == create{{namespace}}ElementWrapper)
62 createWrapperFunction = createV8{{namespace}}DirectWrapper; 61 createWrapperFunction = createV8{{namespace}}DirectWrapper;
63 if (element->isCustomElement()) 62 if (element->isCustomElement())
64 return CustomElementWrapper<{{namespace}}Element, V8{{namespace}}Element >::wrap(element, creationContext, isolate, createWrapperFunction); 63 return CustomElementWrapper<{{namespace}}Element, V8{{namespace}}Element >::wrap(element, creationContext, isolate, createWrapperFunction);
65 64
66 if (createWrapperFunction) 65 if (createWrapperFunction)
67 return createWrapperFunction(element, creationContext, isolate); 66 return createWrapperFunction(element, creationContext, isolate);
68 {%- if fallback_js_interface == namespace + "Element" %} 67 {%- if fallback_js_interface == namespace + "Element" %}
(...skipping 15 matching lines...) Expand all
84 {%- endfor %} 83 {%- endfor %}
85 } 84 }
86 85
87 if (const WrapperTypeInfo* result = map.get(name.impl())) 86 if (const WrapperTypeInfo* result = map.get(name.impl()))
88 return result; 87 return result;
89 88
90 return WrapperTypeTraits<{{fallback_js_interface}}>::wrapperTypeInfo(); 89 return WrapperTypeTraits<{{fallback_js_interface}}>::wrapperTypeInfo();
91 } 90 }
92 91
93 } 92 }
OLDNEW
« no previous file with comments | « Source/build/scripts/templates/ElementFactory.cpp.tmpl ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698