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

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

Issue 413393003: Blink-in-JS: Implement internal APIs exposed only to private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/scripts/v8_interface.py ('k') | 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return 'functionTemplate' 92 return 'functionTemplate'
93 if 'Unforgeable' in extended_attributes: 93 if 'Unforgeable' in extended_attributes:
94 return 'instanceTemplate' 94 return 'instanceTemplate'
95 return 'prototypeTemplate' 95 return 'prototypeTemplate'
96 96
97 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes 97 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes
98 if is_implemented_in_private_script: 98 if is_implemented_in_private_script:
99 includes.add('bindings/core/v8/PrivateScriptRunner.h') 99 includes.add('bindings/core/v8/PrivateScriptRunner.h')
100 includes.add('core/frame/LocalFrame.h') 100 includes.add('core/frame/LocalFrame.h')
101 includes.add('platform/ScriptForbiddenScope.h') 101 includes.add('platform/ScriptForbiddenScope.h')
102
103 # [OnlyExposedToPrivateScript]
104 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended _attributes
105
102 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments') 106 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments')
103 if is_call_with_script_arguments: 107 if is_call_with_script_arguments:
104 includes.update(['bindings/core/v8/ScriptCallStackFactory.h', 108 includes.update(['bindings/core/v8/ScriptCallStackFactory.h',
105 'core/inspector/ScriptArguments.h']) 109 'core/inspector/ScriptArguments.h'])
106 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') 110 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState')
107 if is_call_with_script_state: 111 if is_call_with_script_state:
108 includes.add('bindings/core/v8/ScriptState.h') 112 includes.add('bindings/core/v8/ScriptState.h')
109 is_check_security_for_node = 'CheckSecurity' in extended_attributes 113 is_check_security_for_node = 'CheckSecurity' in extended_attributes
110 if is_check_security_for_node: 114 if is_check_security_for_node:
111 includes.add('bindings/core/v8/BindingSecurity.h') 115 includes.add('bindings/core/v8/BindingSecurity.h')
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 'is_variadic': arguments and arguments[-1].is_variadic, 173 'is_variadic': arguments and arguments[-1].is_variadic,
170 'measure_as': v8_utilities.measure_as(method), # [MeasureAs] 174 'measure_as': v8_utilities.measure_as(method), # [MeasureAs]
171 'name': name, 175 'name': name,
172 'number_of_arguments': len(arguments), 176 'number_of_arguments': len(arguments),
173 'number_of_required_arguments': len([ 177 'number_of_required_arguments': len([
174 argument for argument in arguments 178 argument for argument in arguments
175 if not (argument.is_optional or argument.is_variadic)]), 179 if not (argument.is_optional or argument.is_variadic)]),
176 'number_of_required_or_variadic_arguments': len([ 180 'number_of_required_or_variadic_arguments': len([
177 argument for argument in arguments 181 argument for argument in arguments
178 if not argument.is_optional]), 182 if not argument.is_optional]),
179 'only_exposed_to_private_script': 'OnlyExposedToPrivateScript' in extend ed_attributes, 183 'only_exposed_to_private_script': is_only_exposed_to_private_script,
180 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(method), # [PerContextEnabled] 184 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(method), # [PerContextEnabled]
181 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 185 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
182 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True), 186 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True),
183 'property_attributes': property_attributes(method), 187 'property_attributes': property_attributes(method),
184 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled] 188 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled]
189 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
185 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig nature' in extended_attributes else 'defaultSignature', 190 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig nature' in extended_attributes else 'defaultSignature',
186 'union_arguments': idl_type.union_arguments, 191 'union_arguments': idl_type.union_arguments,
187 'use_local_result': use_local_result(method), 192 'use_local_result': use_local_result(method),
188 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 193 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
189 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 194 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
190 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings], 195 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings],
191 } 196 }
192 197
193 198
194 def argument_context(interface, method, argument, index): 199 def argument_context(interface, method, argument, index):
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 393
389 394
390 def argument_default_cpp_value(argument): 395 def argument_default_cpp_value(argument):
391 if not argument.default_value: 396 if not argument.default_value:
392 return None 397 return None
393 return argument.idl_type.literal_cpp_value(argument.default_value) 398 return argument.idl_type.literal_cpp_value(argument.default_value)
394 399
395 IdlType.union_arguments = property(lambda self: None) 400 IdlType.union_arguments = property(lambda self: None)
396 IdlUnionType.union_arguments = property(union_arguments) 401 IdlUnionType.union_arguments = property(union_arguments)
397 IdlArgument.default_cpp_value = property(argument_default_cpp_value) 402 IdlArgument.default_cpp_value = property(argument_default_cpp_value)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698