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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_callback_function.py

Issue 2857853007: Rename |m_scriptState| to |script_state_| in IDL bindings. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 a callback function. 5 """Generate template values for a callback function.
6 6
7 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler 7 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
8 """ 8 """
9 9
10 from v8_globals import includes # pylint: disable=W0403 10 from v8_globals import includes # pylint: disable=W0403
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 'header_includes': sorted(CALLBACK_FUNCTION_H_INCLUDES), 50 'header_includes': sorted(CALLBACK_FUNCTION_H_INCLUDES),
51 'idl_type': idl_type_str, 51 'idl_type': idl_type_str,
52 } 52 }
53 53
54 if idl_type_str != 'void': 54 if idl_type_str != 'void':
55 context.update({ 55 context.update({
56 'return_cpp_type': idl_type.cpp_type + '&', 56 'return_cpp_type': idl_type.cpp_type + '&',
57 'return_value': idl_type.v8_value_to_local_cpp_value( 57 'return_value': idl_type.v8_value_to_local_cpp_value(
58 callback_function.extended_attributes, 58 callback_function.extended_attributes,
59 'v8ReturnValue', 'cppValue', 59 'v8ReturnValue', 'cppValue',
60 isolate='m_scriptState->GetIsolate()', 60 isolate='script_state_->GetIsolate()',
61 bailout_return_value='false'), 61 bailout_return_value='false'),
62 }) 62 })
63 63
64 context.update(arguments_context(callback_function.arguments, context.get('r eturn_cpp_type'))) 64 context.update(arguments_context(callback_function.arguments, context.get('r eturn_cpp_type')))
65 return context 65 return context
66 66
67 67
68 def arguments_context(arguments, return_cpp_type): 68 def arguments_context(arguments, return_cpp_type):
69 def argument_context(argument): 69 def argument_context(argument):
70 return { 70 return {
71 'argument_name': '%sArgument' % argument.name, 71 'argument_name': '%sArgument' % argument.name,
72 'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value( 72 'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value(
73 argument.name, isolate='m_scriptState->GetIsolate()', 73 argument.name, isolate='script_state_->GetIsolate()',
74 creation_context='m_scriptState->GetContext()->Global()'), 74 creation_context='script_state_->GetContext()->Global()'),
75 } 75 }
76 76
77 argument_declarations = [ 77 argument_declarations = [
78 'ScriptWrappable* scriptWrappable', 78 'ScriptWrappable* scriptWrappable',
79 ] 79 ]
80 argument_declarations.extend( 80 argument_declarations.extend(
81 '%s %s' % (argument.idl_type.callback_cpp_type, argument.name) 81 '%s %s' % (argument.idl_type.callback_cpp_type, argument.name)
82 for argument in arguments) 82 for argument in arguments)
83 if return_cpp_type: 83 if return_cpp_type:
84 argument_declarations.append('%s returnValue' % return_cpp_type) 84 argument_declarations.append('%s returnValue' % return_cpp_type)
85 return { 85 return {
86 'argument_declarations': argument_declarations, 86 'argument_declarations': argument_declarations,
87 'arguments': [argument_context(argument) for argument in arguments], 87 'arguments': [argument_context(argument) for argument in arguments],
88 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698