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

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

Issue 53483004: IDL compiler: [Clamp] for arguments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comment changes Created 7 years, 1 month 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 | « no previous file | Source/bindings/templates/methods.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 argument for argument in arguments 52 argument for argument in arguments
53 if not (argument.is_optional or argument.is_variadic)]), 53 if not (argument.is_optional or argument.is_variadic)]),
54 'number_of_required_or_variadic_arguments': len([ 54 'number_of_required_or_variadic_arguments': len([
55 argument for argument in arguments 55 argument for argument in arguments
56 if not argument.is_optional]), 56 if not argument.is_optional]),
57 } 57 }
58 return contents 58 return contents
59 59
60 60
61 def generate_argument(method, argument, index): 61 def generate_argument(method, argument, index):
62 extended_attributes = argument.extended_attributes
62 idl_type = argument.idl_type 63 idl_type = argument.idl_type
63 return { 64 return {
64 'cpp_method': cpp_method(method, index), 65 'cpp_method': cpp_method(method, index),
65 'cpp_type': v8_types.cpp_type(idl_type), 66 'cpp_type': v8_types.cpp_type(idl_type),
66 'enum_validation_expression': v8_utilities.enum_validation_expression(id l_type), 67 'enum_validation_expression': v8_utilities.enum_validation_expression(id l_type),
67 'idl_type': argument.idl_type, 68 'idl_type': argument.idl_type,
68 'index': index, 69 'index': index,
70 'is_clamp': 'Clamp' in extended_attributes,
69 'is_optional': argument.is_optional, 71 'is_optional': argument.is_optional,
70 'is_variadic_wrapper_type': argument.is_variadic and v8_types.is_wrapper _type(idl_type), 72 'is_variadic_wrapper_type': argument.is_variadic and v8_types.is_wrapper _type(idl_type),
71 'name': argument.name, 73 'name': argument.name,
72 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, ind ex), 74 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, ind ex),
73 } 75 }
74 76
75 77
76 def cpp_method(method, number_of_arguments): 78 def cpp_method(method, number_of_arguments):
77 def cpp_argument(argument): 79 def cpp_argument(argument):
78 if argument.idl_type in ('NodeFilter', 'XPathNSResolver'): 80 if argument.idl_type in ('NodeFilter', 'XPathNSResolver'):
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 113
112 def v8_value_to_local_cpp_value(argument, index): 114 def v8_value_to_local_cpp_value(argument, index):
113 idl_type = argument.idl_type 115 idl_type = argument.idl_type
114 name = argument.name 116 name = argument.name
115 if argument.is_variadic: 117 if argument.is_variadic:
116 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(args, {index}))'.format( 118 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(args, {index}))'.format(
117 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index) 119 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index)
118 return v8_types.v8_value_to_local_cpp_value( 120 return v8_types.v8_value_to_local_cpp_value(
119 idl_type, argument.extended_attributes, 121 idl_type, argument.extended_attributes,
120 'args[%s]' % index, name, 'args.GetIsolate()', index=index) 122 'args[%s]' % index, name, 'args.GetIsolate()', index=index)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698