OLD | NEW |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 idl_type = argument.idl_type | 55 idl_type = argument.idl_type |
56 base_type = not idl_type.array_or_sequence_type and idl_type.base_type | 56 base_type = not idl_type.array_or_sequence_type and idl_type.base_type |
57 | 57 |
58 return not ( | 58 return not ( |
59 # These cases are handled by separate code paths in the | 59 # These cases are handled by separate code paths in the |
60 # generate_argument() macro in Source/bindings/templates/methods.cpp. | 60 # generate_argument() macro in Source/bindings/templates/methods.cpp. |
61 idl_type.is_callback_interface or | 61 idl_type.is_callback_interface or |
62 base_type == 'SerializedScriptValue' or | 62 base_type == 'SerializedScriptValue' or |
63 (argument.is_variadic and idl_type.is_wrapper_type) or | 63 (argument.is_variadic and idl_type.is_wrapper_type) or |
64 # String and enumeration arguments converted using one of the | 64 # String and enumeration arguments converted using one of the |
65 # TOSTRING_* macros in Source/bindings/v8/V8BindingMacros.h don't | 65 # TOSTRING_* macros in Source/bindings/core/v8/V8BindingMacros.h don't |
66 # use a v8::TryCatch. | 66 # use a v8::TryCatch. |
67 (base_type == 'DOMString' and not argument.is_variadic)) | 67 (base_type == 'DOMString' and not argument.is_variadic)) |
68 | 68 |
69 | 69 |
70 def method_context(interface, method): | 70 def method_context(interface, method): |
71 arguments = method.arguments | 71 arguments = method.arguments |
72 extended_attributes = method.extended_attributes | 72 extended_attributes = method.extended_attributes |
73 idl_type = method.idl_type | 73 idl_type = method.idl_type |
74 is_static = method.is_static | 74 is_static = method.is_static |
75 name = method.name | 75 name = method.name |
76 | 76 |
77 idl_type.add_includes_for_type() | 77 idl_type.add_includes_for_type() |
78 this_cpp_value = cpp_value(interface, method, len(arguments)) | 78 this_cpp_value = cpp_value(interface, method, len(arguments)) |
79 | 79 |
80 def function_template(): | 80 def function_template(): |
81 if is_static: | 81 if is_static: |
82 return 'functionTemplate' | 82 return 'functionTemplate' |
83 if 'Unforgeable' in extended_attributes: | 83 if 'Unforgeable' in extended_attributes: |
84 return 'instanceTemplate' | 84 return 'instanceTemplate' |
85 return 'prototypeTemplate' | 85 return 'prototypeTemplate' |
86 | 86 |
87 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') |
88 if is_call_with_script_arguments: | 88 if is_call_with_script_arguments: |
89 includes.update(['bindings/v8/ScriptCallStackFactory.h', | 89 includes.update(['bindings/core/v8/ScriptCallStackFactory.h', |
90 'core/inspector/ScriptArguments.h']) | 90 'core/inspector/ScriptArguments.h']) |
91 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith',
'ScriptState') | 91 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith',
'ScriptState') |
92 if is_call_with_script_state: | 92 if is_call_with_script_state: |
93 includes.add('bindings/v8/ScriptState.h') | 93 includes.add('bindings/core/v8/ScriptState.h') |
94 is_check_security_for_node = 'CheckSecurity' in extended_attributes | 94 is_check_security_for_node = 'CheckSecurity' in extended_attributes |
95 if is_check_security_for_node: | 95 if is_check_security_for_node: |
96 includes.add('bindings/v8/BindingSecurity.h') | 96 includes.add('bindings/core/v8/BindingSecurity.h') |
97 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute
s | 97 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute
s |
98 if is_custom_element_callbacks: | 98 if is_custom_element_callbacks: |
99 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') | 99 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') |
100 | 100 |
101 is_check_security_for_frame = ( | 101 is_check_security_for_frame = ( |
102 'CheckSecurity' in interface.extended_attributes and | 102 'CheckSecurity' in interface.extended_attributes and |
103 'DoNotCheckSecurity' not in extended_attributes) | 103 'DoNotCheckSecurity' not in extended_attributes) |
104 is_raises_exception = 'RaisesException' in extended_attributes | 104 is_raises_exception = 'RaisesException' in extended_attributes |
105 | 105 |
106 arguments_need_try_catch = any(argument_needs_try_catch(argument) | 106 arguments_need_try_catch = any(argument_needs_try_catch(argument) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 | 332 |
333 def argument_default_cpp_value(argument): | 333 def argument_default_cpp_value(argument): |
334 if not argument.default_value: | 334 if not argument.default_value: |
335 return None | 335 return None |
336 return argument.idl_type.literal_cpp_value(argument.default_value) | 336 return argument.idl_type.literal_cpp_value(argument.default_value) |
337 | 337 |
338 IdlType.union_arguments = property(lambda self: None) | 338 IdlType.union_arguments = property(lambda self: None) |
339 IdlUnionType.union_arguments = property(union_arguments) | 339 IdlUnionType.union_arguments = property(union_arguments) |
340 IdlArgument.default_cpp_value = property(argument_default_cpp_value) | 340 IdlArgument.default_cpp_value = property(argument_default_cpp_value) |
OLD | NEW |