| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generate template values for V8PrivateScriptInterface. | 5 """Generate template values for V8PrivateScriptInterface. |
| 6 | 6 |
| 7 Blink-in-JS design doc: https://docs.google.com/a/google.com/document/d/13cT9Klg
vt_ciAR3ONGvzKvw6fz9-f6E0FrqYFqfoc8Y/edit | 7 Blink-in-JS design doc: https://docs.google.com/a/google.com/document/d/13cT9Klg
vt_ciAR3ONGvzKvw6fz9-f6E0FrqYFqfoc8Y/edit |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 from idl_types import IdlType | 10 from idl_types import IdlType |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 | 50 |
| 51 def method_context(operation): | 51 def method_context(operation): |
| 52 extended_attributes = operation.extended_attributes | 52 extended_attributes = operation.extended_attributes |
| 53 idl_type = operation.idl_type | 53 idl_type = operation.idl_type |
| 54 idl_type_str = str(idl_type) | 54 idl_type_str = str(idl_type) |
| 55 contents = { | 55 contents = { |
| 56 'cpp_type': idl_type.cpp_type_args(raw_type=True), | 56 'cpp_type': idl_type.cpp_type_args(raw_type=True), |
| 57 'name': operation.name, | 57 'name': operation.name, |
| 58 'v8_value_to_cpp_value': v8_types.v8_value_to_cpp_value( | 58 'v8_value_to_cpp_value': v8_types.v8_value_to_cpp_value( |
| 59 idl_type, extended_attributes, 'v8Value', 0, | 59 idl_type, extended_attributes, 'v8Value', 0, 'scriptState->isolate()
'), |
| 60 isolate='scriptState->isolate()'), | |
| 61 } | 60 } |
| 62 contents.update(arguments_context(operation.arguments, idl_type)) | 61 contents.update(arguments_context(operation.arguments, idl_type)) |
| 63 return contents | 62 return contents |
| 64 | 63 |
| 65 | 64 |
| 66 def arguments_context(arguments, idl_type): | 65 def arguments_context(arguments, idl_type): |
| 67 def argument_context(argument): | 66 def argument_context(argument): |
| 68 return { | 67 return { |
| 69 'handle': '%sHandle' % argument.name, | 68 'handle': '%sHandle' % argument.name, |
| 70 'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value( | 69 'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value( |
| 71 argument.name, isolate='scriptState->isolate()', | 70 argument.name, isolate='scriptState->isolate()', |
| 72 creation_context='scriptState->context()->Global()'), | 71 creation_context='scriptState->context()->Global()'), |
| 73 } | 72 } |
| 74 | 73 |
| 75 argument_declarations = ['LocalFrame* frame'] | 74 argument_declarations = ['LocalFrame* frame'] |
| 76 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( | 75 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( |
| 77 used_as_argument=True), argument.name) for argument in arguments]) | 76 used_as_argument=True), argument.name) for argument in arguments]) |
| 78 if idl_type.name != 'void': | 77 if idl_type.name != 'void': |
| 79 argument_declarations.append('%s* %s' % (idl_type.cpp_type, 'output')) | 78 argument_declarations.append('%s* %s' % (idl_type.cpp_type, 'output')) |
| 80 return { | 79 return { |
| 81 'argument_declarations': argument_declarations, | 80 'argument_declarations': argument_declarations, |
| 82 'arguments': [argument_context(argument) for argument in arguments], | 81 'arguments': [argument_context(argument) for argument in arguments], |
| 83 } | 82 } |
| OLD | NEW |