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

Side by Side Diff: Source/bindings/scripts/v8_methods.py

Issue 1322533002: bindings: Supports to change the method location. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed review comments. Created 5 years, 3 months 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 | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/scripts/v8_utilities.py » ('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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 extended_attributes = method.extended_attributes 68 extended_attributes = method.extended_attributes
69 idl_type = method.idl_type 69 idl_type = method.idl_type
70 is_static = method.is_static 70 is_static = method.is_static
71 name = method.name 71 name = method.name
72 72
73 if is_visible: 73 if is_visible:
74 idl_type.add_includes_for_type(extended_attributes) 74 idl_type.add_includes_for_type(extended_attributes)
75 75
76 this_cpp_value = cpp_value(interface, method, len(arguments)) 76 this_cpp_value = cpp_value(interface, method, len(arguments))
77 77
78 def function_template():
79 if is_static:
80 return 'functionTemplate'
81 if is_unforgeable(interface, method):
82 return 'instanceTemplate'
83 return 'prototypeTemplate'
84
85 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes 78 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes
86 if is_implemented_in_private_script: 79 if is_implemented_in_private_script:
87 includes.add('bindings/core/v8/PrivateScriptRunner.h') 80 includes.add('bindings/core/v8/PrivateScriptRunner.h')
88 includes.add('core/frame/LocalFrame.h') 81 includes.add('core/frame/LocalFrame.h')
89 includes.add('platform/ScriptForbiddenScope.h') 82 includes.add('platform/ScriptForbiddenScope.h')
90 83
91 # [OnlyExposedToPrivateScript] 84 # [OnlyExposedToPrivateScript]
92 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended _attributes 85 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended _attributes
93 86
94 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments') 87 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments')
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 'conditional_string': v8_utilities.conditional_string(method), 130 'conditional_string': v8_utilities.conditional_string(method),
138 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) 131 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type)
139 if idl_type.is_explicit_nullable else idl_type.cpp_type), 132 if idl_type.is_explicit_nullable else idl_type.cpp_type),
140 'cpp_value': this_cpp_value, 133 'cpp_value': this_cpp_value,
141 'cpp_type_initializer': idl_type.cpp_type_initializer, 134 'cpp_type_initializer': idl_type.cpp_type_initializer,
142 'custom_registration_extended_attributes': 135 'custom_registration_extended_attributes':
143 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( 136 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection(
144 extended_attributes.iterkeys()), 137 extended_attributes.iterkeys()),
145 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] 138 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs]
146 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] 139 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed]
147 'function_template': function_template(), 140 # TODO(yukishiino): Retire has_custom_registration flag. Should be
141 # replaced with V8DOMConfiguration::PropertyLocationConfiguration.
148 'has_custom_registration': 142 'has_custom_registration':
149 is_static or 143 is_static or
150 is_unforgeable(interface, method) or 144 is_unforgeable(interface, method) or
151 v8_utilities.has_extended_attribute( 145 v8_utilities.has_extended_attribute(
152 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), 146 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES),
153 'has_exception_state': 147 'has_exception_state':
154 is_raises_exception or 148 is_raises_exception or
155 is_check_security_for_frame or 149 is_check_security_for_frame or
156 is_check_security_for_window or 150 is_check_security_for_window or
157 any(argument for argument in arguments 151 any(argument for argument in arguments
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 'on_instance': v8_utilities.on_instance(interface, method), 188 'on_instance': v8_utilities.on_instance(interface, method),
195 'on_interface': v8_utilities.on_interface(interface, method), 189 'on_interface': v8_utilities.on_interface(interface, method),
196 'on_prototype': v8_utilities.on_prototype(interface, method), 190 'on_prototype': v8_utilities.on_prototype(interface, method),
197 'only_exposed_to_private_script': is_only_exposed_to_private_script, 191 'only_exposed_to_private_script': is_only_exposed_to_private_script,
198 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 192 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
199 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', bailout_return_value='false'), 193 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', bailout_return_value='false'),
200 'property_attributes': property_attributes(interface, method), 194 'property_attributes': property_attributes(interface, method),
201 'returns_promise': method.returns_promise, 195 'returns_promise': method.returns_promise,
202 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled] 196 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled]
203 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), 197 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
204 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig nature' in extended_attributes else 'defaultSignature',
205 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res ult, 198 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res ult,
206 'use_local_result': use_local_result(method), 199 'use_local_result': use_local_result(method),
207 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 200 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
208 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 201 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
209 'visible': is_visible, 202 'visible': is_visible,
210 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings], 203 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings],
211 } 204 }
212 205
213 206
214 def argument_context(interface, method, argument, index, is_visible=True): 207 def argument_context(interface, method, argument, index, is_visible=True):
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 return method.idl_type and method.idl_type.name == 'Promise' 467 return method.idl_type and method.idl_type.name == 'Promise'
475 468
476 IdlOperation.returns_promise = property(method_returns_promise) 469 IdlOperation.returns_promise = property(method_returns_promise)
477 470
478 471
479 def argument_conversion_needs_exception_state(method, argument): 472 def argument_conversion_needs_exception_state(method, argument):
480 idl_type = argument.idl_type 473 idl_type = argument.idl_type
481 return (idl_type.v8_conversion_needs_exception_state or 474 return (idl_type.v8_conversion_needs_exception_state or
482 argument.is_variadic or 475 argument.is_variadic or
483 (method.returns_promise and idl_type.is_string_type)) 476 (method.returns_promise and idl_type.is_string_type))
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/scripts/v8_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698