Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {% filter format_blink_cpp_source_code %} | 1 {% filter format_blink_cpp_source_code %} |
| 2 | 2 |
| 3 {% include 'copyright_block.txt' %} | 3 {% include 'copyright_block.txt' %} |
| 4 #ifndef {{v8_class}}_h | 4 #ifndef {{v8_class}}_h |
| 5 #define {{v8_class}}_h | 5 #define {{v8_class}}_h |
| 6 | 6 |
| 7 {% for filename in header_includes %} | 7 {% for filename in header_includes %} |
| 8 #include "{{filename}}" | 8 #include "{{filename}}" |
| 9 {% endfor %} | 9 {% endfor %} |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 {% if has_event_constructor %} | 13 {% if has_event_constructor %} |
| 14 class Dictionary; | 14 class Dictionary; |
| 15 {% endif %} | 15 {% endif %} |
| 16 {% if origin_trial_attributes %} | 16 {% if origin_trial_attributes %} |
| 17 class ScriptState; | 17 class ScriptState; |
| 18 {% endif %} | 18 {% endif %} |
| 19 {% if named_constructor %} | 19 {% if named_constructor %} |
| 20 class {{v8_class}}Constructor { | 20 class {{v8_class}}Constructor { |
| 21 STATIC_ONLY({{v8_class}}Constructor); | 21 STATIC_ONLY({{v8_class}}Constructor); |
| 22 public: | 22 public: |
| 23 static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*, const DOMWrap perWorld&); | 23 static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*, const DOMWrap perWorld&); |
| 24 {{exported}}static const WrapperTypeInfo wrapperTypeInfo; | 24 {{exported}}static const WrapperTypeInfo wrapperTypeInfo; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 {% endif %} | 27 {% endif %} |
| 28 class {{v8_class}} { | 28 class {{v8_class}} { |
|
Yuki
2017/01/26 08:01:35
If no one has an objection, I'd slightly prefer ad
bashi
2017/01/26 08:22:10
IIUC tasak@ tried hard to minimize the number of e
peria
2017/01/26 08:44:52
+1.
Done.
Keep partial interface classes non expo
peria
2017/01/26 09:35:24
Changing scope of {{exposed}} seems to violate vis
| |
| 29 STATIC_ONLY({{v8_class}}); | 29 STATIC_ONLY({{v8_class}}); |
| 30 public: | 30 public: |
| 31 {% if is_array_buffer_or_view %} | 31 {% if is_array_buffer_or_view %} |
| 32 {{exported}}static {{cpp_class}}* toImpl(v8::Local<v8::Object> object); | 32 {{exported}}static {{cpp_class}}* toImpl(v8::Local<v8::Object> object); |
| 33 {% else %} | 33 {% else %} |
| 34 {{exported}}static bool hasInstance(v8::Local<v8::Value>, v8::Isolate*); | 34 {{exported}}static bool hasInstance(v8::Local<v8::Value>, v8::Isolate*); |
| 35 static v8::Local<v8::Object> findInstanceInPrototypeChain(v8::Local<v8::Value> , v8::Isolate*); | 35 static v8::Local<v8::Object> findInstanceInPrototypeChain(v8::Local<v8::Value> , v8::Isolate*); |
| 36 {{exported}}static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*, c onst DOMWrapperWorld&); | 36 {{exported}}static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*, c onst DOMWrapperWorld&); |
| 37 {% if has_named_properties_object %} | 37 {% if has_named_properties_object %} |
| 38 {{exported}}static v8::Local<v8::FunctionTemplate> domTemplateForNamedProperti esObject(v8::Isolate*, const DOMWrapperWorld&); | 38 {{exported}}static v8::Local<v8::FunctionTemplate> domTemplateForNamedProperti esObject(v8::Isolate*, const DOMWrapperWorld&); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 {% endif %} | 160 {% endif %} |
| 161 | 161 |
| 162 {% for feature in origin_trial_features %} | 162 {% for feature in origin_trial_features %} |
| 163 | 163 |
| 164 static void install{{feature.name}}(v8::Isolate*, const DOMWrapperWorld&, v8:: Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Funct ion> interface); | 164 static void install{{feature.name}}(v8::Isolate*, const DOMWrapperWorld&, v8:: Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Funct ion> interface); |
| 165 static void install{{feature.name}}(ScriptState*, v8::Local<v8::Object> instan ce); | 165 static void install{{feature.name}}(ScriptState*, v8::Local<v8::Object> instan ce); |
| 166 {% if not feature.needs_instance %} | 166 {% if not feature.needs_instance %} |
| 167 static void install{{feature.name}}(ScriptState*); | 167 static void install{{feature.name}}(ScriptState*); |
| 168 {% endif %} | 168 {% endif %} |
| 169 {% endfor %} | 169 {% endfor %} |
| 170 | |
| 171 // Callback functions | |
|
Yuki
2017/01/26 08:01:35
Probably, it's a little cleaner to put these membe
peria
2017/01/26 08:44:52
It seems difficult because some functions are acce
| |
| 172 {% for constant in constants | has_special_getter %} | |
| 173 {{exported}}static void {{constant.name}}ConstantGetterCallback(v8::Local<v8:: Name>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 174 {% endfor %} | |
| 175 | |
| 176 {% for attribute in attributes %} | |
| 177 {% if attribute.is_cached_accessor %} | |
| 178 {{exported}}static v8::Local<v8::Private> {{attribute.name}}CachedAccessorCall back(v8::Isolate*); | |
| 179 {% endif %} | |
| 180 {% for world_suffix in attribute.world_suffixes %} | |
| 181 {% if not attribute.constructor_type %} | |
| 182 {{exported}}static void {{attribute.name}}AttributeGetterCallback{{world_suffi x}}( | |
| 183 {%- if attribute.is_data_type_property -%} | |
| 184 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& | |
| 185 {%- else -%} | |
| 186 const v8::FunctionCallbackInfo<v8::Value>& | |
| 187 {%- endif -%}); | |
| 188 {% elif attribute.needs_constructor_getter_callback %} | |
| 189 {{exported}}static void {{attribute.name}}ConstructorGetterCallback{{world_suf fix}}(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 190 {% endif %} | |
| 191 {% if attribute.has_setter %} | |
| 192 {{exported}}static void {{attribute.name}}AttributeSetterCallback{{world_suffi x}}( | |
| 193 {%- if attribute.is_data_type_property -%} | |
| 194 v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<vo id>& | |
| 195 {%- else -%} | |
| 196 const v8::FunctionCallbackInfo<v8::Value>& | |
| 197 {%- endif -%}); | |
| 198 {% endif %} | |
| 199 {% endfor %} | |
| 200 {% endfor %} | |
| 201 | |
| 202 {% for method in methods %} | |
| 203 {% for world_suffix in method.world_suffixes %} | |
| 204 {% if not method.overload_index or method.overloads %} | |
| 205 {# Document about the following condition: #} | |
| 206 {# https://docs.google.com/document/d/1qBC7Therp437Jbt_QYAtNYMZs6zQ_7_tnMkNUG_ ACqs/edit?usp=sharing #} | |
| 207 {% if (method.overloads and method.overloads.visible and | |
| 208 (not method.overloads.has_partial_overloads or not is_partial)) or | |
| 209 (not method.overloads and method.visible) %} | |
| 210 {# A single callback is generated for overloaded methods #} | |
| 211 {# with considering partial overloads #} | |
| 212 {{exported}}static void {{method.name}}MethodCallback{{world_suffix}}(const v8 ::FunctionCallbackInfo<v8::Value>&); | |
| 213 {% endif %} | |
| 214 {% endif %} | |
| 215 {% if method.is_cross_origin and method.visible %} | |
| 216 {{exported}}static void {{method.name}}OriginSafeMethodGetterCallback{{world_s uffix}}(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 217 {% endif %} | |
| 218 {% endfor %} | |
| 219 {% endfor %} | |
| 220 {% if iterator_method %} | |
| 221 {{exported}}static void {{iterator_method.name}}MethodCallback(const v8::Funct ionCallbackInfo<v8::Value>&); | |
| 222 {% endif %} | |
| 223 {% if has_origin_safe_method_setter %} | |
| 224 {{exported}}static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local< v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&); | |
| 225 {% endif %} | |
| 226 | |
| 227 {% if has_access_check_callbacks and not is_partial %} | |
| 228 {{exported}}static bool securityCheck(v8::Local<v8::Context>, v8::Local<v8::Ob ject>, v8::Local<v8::Value>); | |
| 229 {% if has_cross_origin_named_getter %} | |
| 230 {{exported}}static void crossOriginNamedGetter(v8::Local<v8::Name>, const v8:: PropertyCallbackInfo<v8::Value>&); | |
| 231 {% endif %} | |
| 232 {% if has_cross_origin_named_setter %} | |
| 233 {{exported}}static void crossOriginNamedSetter(v8::Local<v8::Name>, v8::Local< v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 234 {% endif %} | |
| 235 {% if has_cross_origin_named_enumerator %} | |
| 236 {{exported}}static void crossOriginNamedEnumerator(const v8::PropertyCallbackI nfo<v8::Array>&); | |
| 237 {% endif %} | |
| 238 {% if has_cross_origin_indexed_getter %} | |
| 239 {{exported}}static void crossOriginIndexedGetter(uint32_t index, const v8::Pro pertyCallbackInfo<v8::Value>&); | |
| 240 {% endif %} | |
| 241 {% endif %} | |
| 242 | |
| 243 {% if named_property_getter %} | |
| 244 {{exported}}static void namedPropertyGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 245 {% endif %} | |
| 246 {% if named_property_setter %} | |
| 247 {{exported}}static void namedPropertySetterCallback(v8::Local<v8::Name>, v8::L ocal<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 248 {% endif %} | |
| 249 {% if named_property_deleter %} | |
| 250 {{exported}}static void namedPropertyDeleterCallback(v8::Local<v8::Name>, cons t v8::PropertyCallbackInfo<v8::Boolean>&); | |
| 251 {% endif %} | |
| 252 {% if named_property_getter and named_property_getter.is_enumerable %} | |
| 253 {{exported}}static void namedPropertyQueryCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer>&); | |
| 254 {% endif %} | |
| 255 {% if named_property_getter and named_property_getter.is_enumerable %} | |
| 256 {{exported}}static void namedPropertyEnumeratorCallback(const v8::PropertyCall backInfo<v8::Array>&); | |
| 257 {% endif %} | |
| 258 {% if indexed_property_getter or named_property_getter %} | |
| 259 {{exported}}static void indexedPropertyGetterCallback(uint32_t index, const v8 ::PropertyCallbackInfo<v8::Value>&); | |
| 260 {% endif %} | |
| 261 {% if indexed_property_setter or named_property_setter %} | |
| 262 {{exported}}static void indexedPropertySetterCallback(uint32_t index, v8::Loca l<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&); | |
| 263 {% endif %} | |
| 264 {% if indexed_property_deleter or named_property_deleter %} | |
| 265 {{exported}}static void indexedPropertyDeleterCallback(uint32_t index, const v 8::PropertyCallbackInfo<v8::Boolean>&); | |
| 266 {% endif %} | |
| 267 | |
| 170 {% if has_partial_interface %} | 268 {% if has_partial_interface %} |
| 171 | |
| 172 private: | 269 private: |
| 173 static InstallTemplateFunction install{{v8_class}}TemplateFunction; | 270 static InstallTemplateFunction install{{v8_class}}TemplateFunction; |
| 174 {% endif %} | 271 {% endif %} |
| 175 }; | 272 }; |
| 176 | 273 |
| 177 {% if has_event_constructor %} | 274 {% if has_event_constructor %} |
| 178 {{exported}}bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionState&, const v8::FunctionCallbackInfo<v8::Value>& info); | 275 {{exported}}bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionState&, const v8::FunctionCallbackInfo<v8::Value>& info); |
| 179 | 276 |
| 180 {% endif %} | 277 {% endif %} |
| 181 template <> | 278 template <> |
| 182 struct V8TypeOf<{{cpp_class}}> { | 279 struct V8TypeOf<{{cpp_class}}> { |
| 183 typedef {{v8_class}} Type; | 280 typedef {{v8_class}} Type; |
| 184 }; | 281 }; |
| 185 | 282 |
| 186 } // namespace blink | 283 } // namespace blink |
| 187 | 284 |
| 188 #endif // {{v8_class}}_h | 285 #endif // {{v8_class}}_h |
| 189 | 286 |
| 190 {% endfilter %}{# format_blink_cpp_source_code #} | 287 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |