| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 CALLBACK_INTERFACE_CPP_INCLUDES = set([ | 46 CALLBACK_INTERFACE_CPP_INCLUDES = set([ |
| 47 'core/dom/ScriptExecutionContext.h', | 47 'core/dom/ScriptExecutionContext.h', |
| 48 'bindings/v8/V8Binding.h', | 48 'bindings/v8/V8Binding.h', |
| 49 'bindings/v8/V8Callback.h', | 49 'bindings/v8/V8Callback.h', |
| 50 'wtf/Assertions.h', | 50 'wtf/Assertions.h', |
| 51 ]) | 51 ]) |
| 52 CPP_TO_V8_CONVERSION = 'v8::Handle<v8::Value> {name}Handle = {cpp_value_to_v8_va
lue};' | 52 CPP_TO_V8_CONVERSION = 'v8::Handle<v8::Value> {name}Handle = {cpp_value_to_v8_va
lue};' |
| 53 | 53 |
| 54 | 54 |
| 55 def cpp_to_v8_conversion(idl_type, name): | 55 def cpp_to_v8_conversion(idl_type, name): |
| 56 this_cpp_value_to_v8_value = cpp_value_to_v8_value(idl_type, name, 'isolate'
, creation_context='v8::Handle<v8::Object>()') | 56 # Includes handled in includes_for_operation |
| 57 this_cpp_value_to_v8_value, _ = cpp_value_to_v8_value(idl_type, name, 'isola
te', creation_context='v8::Handle<v8::Object>()') |
| 57 return CPP_TO_V8_CONVERSION.format(name=name, cpp_value_to_v8_value=this_cpp
_value_to_v8_value) | 58 return CPP_TO_V8_CONVERSION.format(name=name, cpp_value_to_v8_value=this_cpp
_value_to_v8_value) |
| 58 | 59 |
| 59 | 60 |
| 60 def generate_callback_interface(callback_interface): | 61 def generate_callback_interface(callback_interface): |
| 61 cpp_includes = CALLBACK_INTERFACE_CPP_INCLUDES | 62 cpp_includes = CALLBACK_INTERFACE_CPP_INCLUDES |
| 62 | 63 |
| 63 def generate_method(operation): | 64 def generate_method(operation): |
| 64 method_contents, method_cpp_includes = generate_method_and_includes(oper
ation) | 65 method_contents, method_cpp_includes = generate_method_and_includes(oper
ation) |
| 65 cpp_includes.update(method_cpp_includes) | 66 cpp_includes.update(method_cpp_includes) |
| 66 return method_contents | 67 return method_contents |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return { | 111 return { |
| 111 'name': argument.name, | 112 'name': argument.name, |
| 112 'cpp_to_v8_conversion': cpp_to_v8_conversion(argument.data_type, arg
ument.name), | 113 'cpp_to_v8_conversion': cpp_to_v8_conversion(argument.data_type, arg
ument.name), |
| 113 } | 114 } |
| 114 | 115 |
| 115 return { | 116 return { |
| 116 'argument_declarations': [argument_declaration(argument) for argument in
arguments], | 117 'argument_declarations': [argument_declaration(argument) for argument in
arguments], |
| 117 'arguments': [generate_argument(argument) for argument in arguments], | 118 'arguments': [generate_argument(argument) for argument in arguments], |
| 118 'handles': ['%sHandle' % argument.name for argument in arguments], | 119 'handles': ['%sHandle' % argument.name for argument in arguments], |
| 119 } | 120 } |
| OLD | NEW |