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

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

Issue 103963003: IDL compiler: [MeasureAs] 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.cpp » ('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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 has_constructor = 'Constructor' in extended_attributes 76 has_constructor = 'Constructor' in extended_attributes
77 if has_constructor: 77 if has_constructor:
78 includes.add('bindings/v8/V8ObjectConstructor.h') 78 includes.add('bindings/v8/V8ObjectConstructor.h')
79 79
80 # [GenerateVisitDOMWrapper] 80 # [GenerateVisitDOMWrapper]
81 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit DOMWrapper') 81 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit DOMWrapper')
82 if generate_visit_dom_wrapper_function: 82 if generate_visit_dom_wrapper_function:
83 includes.update(['bindings/v8/V8GCController.h', 83 includes.update(['bindings/v8/V8GCController.h',
84 'core/dom/Element.h']) 84 'core/dom/Element.h'])
85 85
86 # [MeasureAs]
87 is_measure_as = 'MeasureAs' in extended_attributes
88 if is_measure_as:
89 includes.add('core/frame/UseCounter.h')
90
86 # [RaisesException] 91 # [RaisesException]
87 is_constructor_raises_exception = extended_attributes.get('RaisesException') == 'Constructor' 92 is_constructor_raises_exception = extended_attributes.get('RaisesException') == 'Constructor'
88 if is_constructor_raises_exception: 93 if is_constructor_raises_exception:
89 includes.add('bindings/v8/ExceptionState.h') 94 includes.add('bindings/v8/ExceptionState.h')
90 95
91 # [SpecialWrapFor] 96 # [SpecialWrapFor]
92 if 'SpecialWrapFor' in extended_attributes: 97 if 'SpecialWrapFor' in extended_attributes:
93 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') 98 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|')
94 else: 99 else:
95 special_wrap_for = [] 100 special_wrap_for = []
(...skipping 10 matching lines...) Expand all
106 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8] 111 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8]
107 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] 112 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap]
108 'has_visit_dom_wrapper': has_extended_attribute(interface, 113 'has_visit_dom_wrapper': has_extended_attribute(interface,
109 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']), 114 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']),
110 'header_includes': INTERFACE_H_INCLUDES, 115 'header_includes': INTERFACE_H_INCLUDES,
111 'interface_name': interface.name, 116 'interface_name': interface.name,
112 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] 117 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject]
113 'is_check_security': is_check_security, 118 'is_check_security': is_check_security,
114 'is_constructor_raises_exception': is_constructor_raises_exception, 119 'is_constructor_raises_exception': is_constructor_raises_exception,
115 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime] 120 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime]
121 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs]
116 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled] 122 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled]
117 'special_wrap_for': special_wrap_for, 123 'special_wrap_for': special_wrap_for,
118 'v8_class': v8_utilities.v8_class_name(interface), 124 'v8_class': v8_utilities.v8_class_name(interface),
119 } 125 }
120 126
121 template_contents.update({ 127 template_contents.update({
122 'constants': [generate_constant(constant) for constant in interface.cons tants], 128 'constants': [generate_constant(constant) for constant in interface.cons tants],
123 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, 129 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
124 }) 130 })
125 131
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 '%s->IsString()' % cpp_value, 280 '%s->IsString()' % cpp_value,
275 '%s->IsObject()' % cpp_value]) 281 '%s->IsObject()' % cpp_value])
276 if v8_types.array_or_sequence_type(idl_type): 282 if v8_types.array_or_sequence_type(idl_type):
277 return '%s->IsArray()' % cpp_value 283 return '%s->IsArray()' % cpp_value
278 if v8_types.is_wrapper_type(idl_type): 284 if v8_types.is_wrapper_type(idl_type):
279 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) 285 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value)
280 if argument['is_nullable']: 286 if argument['is_nullable']:
281 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) 287 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check])
282 return type_check 288 return type_check
283 return None 289 return None
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698