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

Side by Side Diff: Source/bindings/scripts/v8_utilities.py

Issue 457483002: Blink-in-JS: Support partial interfaces in private scripts Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 def enum_validation_expression(idl_type): 110 def enum_validation_expression(idl_type):
111 # FIXME: Add IdlEnumType, move property to derived type, and remove this che ck 111 # FIXME: Add IdlEnumType, move property to derived type, and remove this che ck
112 if not idl_type.is_enum: 112 if not idl_type.is_enum:
113 return None 113 return None
114 return ' || '.join(['string == "%s"' % enum_value 114 return ' || '.join(['string == "%s"' % enum_value
115 for enum_value in idl_type.enum_values]) 115 for enum_value in idl_type.enum_values])
116 IdlType.enum_validation_expression = property(enum_validation_expression) 116 IdlType.enum_validation_expression = property(enum_validation_expression)
117 117
118 118
119 def scoped_name(interface, definition, base_name): 119 def scoped_name(interface, definition, base_name):
120 if 'ImplementedInPrivateScript' in definition.extended_attributes:
121 return '%s::%s' % (v8_class_name(interface), base_name)
120 # partial interfaces are implemented as separate classes, with their members 122 # partial interfaces are implemented as separate classes, with their members
121 # implemented as static member functions 123 # implemented as static member functions
122 partial_interface_implemented_as = definition.extended_attributes.get('Parti alInterfaceImplementedAs') 124 partial_interface_implemented_as = definition.extended_attributes.get('Parti alInterfaceImplementedAs')
123 if partial_interface_implemented_as: 125 if partial_interface_implemented_as:
124 return '%s::%s' % (partial_interface_implemented_as, base_name) 126 return '%s::%s' % (partial_interface_implemented_as, base_name)
125 if (definition.is_static or 127 if (definition.is_static or
126 definition.name in ('Constructor', 'NamedConstructor')): 128 definition.name in ('Constructor', 'NamedConstructor')):
127 return '%s::%s' % (cpp_name(interface), base_name) 129 return '%s::%s' % (cpp_name(interface), base_name)
128 if 'ImplementedInPrivateScript' in definition.extended_attributes:
129 return '%s::%s' % (v8_class_name(interface), base_name)
130 return 'impl->%s' % base_name 130 return 'impl->%s' % base_name
131 131
132 132
133 def v8_class_name(interface): 133 def v8_class_name(interface):
134 return v8_types.v8_type(interface.name) 134 return v8_types.v8_type(interface.name)
135 135
136 136
137 ################################################################################ 137 ################################################################################
138 # Specific extended attributes 138 # Specific extended attributes
139 ################################################################################ 139 ################################################################################
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 The returned function checks if a method/attribute is enabled. 268 The returned function checks if a method/attribute is enabled.
269 Given extended attribute RuntimeEnabled=FeatureName, return: 269 Given extended attribute RuntimeEnabled=FeatureName, return:
270 RuntimeEnabledFeatures::{featureName}Enabled 270 RuntimeEnabledFeatures::{featureName}Enabled
271 """ 271 """
272 extended_attributes = definition_or_member.extended_attributes 272 extended_attributes = definition_or_member.extended_attributes
273 if 'RuntimeEnabled' not in extended_attributes: 273 if 'RuntimeEnabled' not in extended_attributes:
274 return None 274 return None
275 feature_name = extended_attributes['RuntimeEnabled'] 275 feature_name = extended_attributes['RuntimeEnabled']
276 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) 276 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/TestPartialInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698