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

Side by Side Diff: Source/bindings/scripts/unstable/v8_interface.py

Issue 99123003: IDL compiler: [SpecialWrapFor] interfaces (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years 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
« no previous file with comments | « no previous file | Source/bindings/templates/interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 includes.update(['bindings/v8/BindingSecurity.h', 71 includes.update(['bindings/v8/BindingSecurity.h',
72 'bindings/v8/ExceptionMessages.h', 72 'bindings/v8/ExceptionMessages.h',
73 'bindings/v8/ExceptionState.h']) 73 'bindings/v8/ExceptionState.h'])
74 74
75 # [GenerateVisitDOMWrapper] 75 # [GenerateVisitDOMWrapper]
76 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit DOMWrapper') 76 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit DOMWrapper')
77 if generate_visit_dom_wrapper_function: 77 if generate_visit_dom_wrapper_function:
78 includes.update(['bindings/v8/V8GCController.h', 78 includes.update(['bindings/v8/V8GCController.h',
79 'core/dom/Element.h']) 79 'core/dom/Element.h'])
80 80
81 # [SpecialWrapFor]
82 if 'SpecialWrapFor' in extended_attributes:
83 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|')
84 else:
85 special_wrap_for = []
86 for special_wrap_interface in special_wrap_for:
87 v8_types.add_includes_for_type(special_wrap_interface)
88
81 template_contents = { 89 template_contents = {
82 'conditional_string': conditional_string(interface), # [Conditional] 90 'conditional_string': conditional_string(interface), # [Conditional]
83 'cpp_class': cpp_name(interface), 91 'cpp_class': cpp_name(interface),
84 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi on, 92 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi on,
85 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, # [CustomLegacyCall] 93 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, # [CustomLegacyCall]
86 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8] 94 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8]
87 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] 95 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap]
88 'has_visit_dom_wrapper': has_extended_attribute(interface, 96 'has_visit_dom_wrapper': has_extended_attribute(interface,
89 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']), 97 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']),
90 'header_includes': INTERFACE_H_INCLUDES, 98 'header_includes': INTERFACE_H_INCLUDES,
91 'interface_name': interface.name, 99 'interface_name': interface.name,
92 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] 100 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject]
93 'is_check_security': is_check_security, 101 'is_check_security': is_check_security,
94 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime] 102 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime]
95 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled] 103 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled]
104 'special_wrap_for': special_wrap_for,
96 'v8_class': v8_utilities.v8_class_name(interface), 105 'v8_class': v8_utilities.v8_class_name(interface),
97 } 106 }
98 107
99 template_contents.update({ 108 template_contents.update({
100 'constants': [generate_constant(constant) for constant in interface.cons tants], 109 'constants': [generate_constant(constant) for constant in interface.cons tants],
101 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, 110 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
102 }) 111 })
103 112
104 attributes = [v8_attributes.generate_attribute(interface, attribute) 113 attributes = [v8_attributes.generate_attribute(interface, attribute)
105 for attribute in interface.attributes] 114 for attribute in interface.attributes]
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 '%s->IsString()' % cpp_value, 261 '%s->IsString()' % cpp_value,
253 '%s->IsObject()' % cpp_value]) 262 '%s->IsObject()' % cpp_value])
254 if v8_types.array_or_sequence_type(idl_type): 263 if v8_types.array_or_sequence_type(idl_type):
255 return '%s->IsArray()' % cpp_value 264 return '%s->IsArray()' % cpp_value
256 if v8_types.is_wrapper_type(idl_type): 265 if v8_types.is_wrapper_type(idl_type):
257 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) 266 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value)
258 if argument['is_nullable']: 267 if argument['is_nullable']:
259 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) 268 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check])
260 return type_check 269 return type_check
261 return None 270 return None
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698