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

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

Issue 26547005: IDL compiler: [PerContextEnabled] for getters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload Created 7 years, 2 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 def generate_attributes(interface): 43 def generate_attributes(interface):
44 def generate_attribute(attribute): 44 def generate_attribute(attribute):
45 attribute_contents, attribute_includes = generate_attribute_and_includes (interface, attribute) 45 attribute_contents, attribute_includes = generate_attribute_and_includes (interface, attribute)
46 includes.update(attribute_includes) 46 includes.update(attribute_includes)
47 return attribute_contents 47 return attribute_contents
48 48
49 includes = set() 49 includes = set()
50 contents = generate_attributes_common(interface) 50 contents = generate_attributes_common(interface)
51 contents['attributes'] = [generate_attribute(attribute) for attribute in int erface.attributes] 51 contents['attributes'] = [generate_attribute(attribute) for attribute in int erface.attributes]
52 contents['has_per_context_enabled_attributes'] = any(attribute['per_context_ enabled_function_name'] for attribute in contents['attributes'])
52 contents['has_runtime_enabled_attributes'] = any(attribute['runtime_enabled_ function_name'] for attribute in contents['attributes']) 53 contents['has_runtime_enabled_attributes'] = any(attribute['runtime_enabled_ function_name'] for attribute in contents['attributes'])
53 return contents, includes 54 return contents, includes
54 55
55 56
56 def generate_attributes_common(interface): 57 def generate_attributes_common(interface):
57 attributes = interface.attributes 58 attributes = interface.attributes
58 v8_class_name = v8_utilities.v8_class_name(interface) 59 v8_class_name = v8_utilities.v8_class_name(interface)
59 return { 60 return {
60 # Size 0 constant array is not allowed in VC++ 61 # Size 0 constant array is not allowed in VC++
61 'number_of_attributes': 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class_name if attributes else '0', 62 'number_of_attributes': 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class_name if attributes else '0',
62 'attribute_templates': '%sAttributes' % v8_class_name if attributes else '0', 63 'attribute_templates': '%sAttributes' % v8_class_name if attributes else '0',
63 } 64 }
64 65
65 66
66 def generate_attribute_and_includes(interface, attribute): 67 def generate_attribute_and_includes(interface, attribute):
67 idl_type = attribute.data_type 68 idl_type = attribute.data_type
68 extended_attributes = attribute.extended_attributes 69 extended_attributes = attribute.extended_attributes
69 this_is_keep_alive_for_gc = is_keep_alive_for_gc(attribute) 70 this_is_keep_alive_for_gc = is_keep_alive_for_gc(attribute)
70 contents = { 71 contents = {
71 'access_control_list': access_control_list(attribute), 72 'access_control_list': access_control_list(attribute),
72 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'), 73 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'),
73 'conditional_string': v8_utilities.generate_conditional_string(attribute ), 74 'conditional_string': v8_utilities.generate_conditional_string(attribute ),
74 'cpp_type': v8_types.cpp_type(idl_type), 75 'cpp_type': v8_types.cpp_type(idl_type),
75 'runtime_enabled_function_name': v8_utilities.runtime_enabled_function_n ame(attribute), # EnabledAtRuntime 76 'per_context_enabled_function_name': v8_utilities.per_context_enabled_fu nction_name(attribute), # [PerContextEnabled]
77 'runtime_enabled_function_name': v8_utilities.runtime_enabled_function_n ame(attribute), # [RuntimeEnabled]
76 'idl_type': idl_type, 78 'idl_type': idl_type,
77 'is_keep_alive_for_gc': this_is_keep_alive_for_gc, 79 'is_keep_alive_for_gc': this_is_keep_alive_for_gc,
78 'is_nullable': attribute.is_nullable, 80 'is_nullable': attribute.is_nullable,
79 'is_static': attribute.is_static, 81 'is_static': attribute.is_static,
80 'name': attribute.name, 82 'name': attribute.name,
81 'property_attributes': property_attributes(attribute), 83 'property_attributes': property_attributes(attribute),
82 'v8_type': v8_types.v8_type(idl_type), 84 'v8_type': v8_types.v8_type(idl_type),
83 } 85 }
84 if has_extended_attribute(attribute, ('Custom', 'CustomGetter')): 86 if has_extended_attribute(attribute, ('Custom', 'CustomGetter')):
85 contents['is_custom_getter'] = True 87 contents['is_custom_getter'] = True
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return ['v8::ALL_CAN_READ'] 223 return ['v8::ALL_CAN_READ']
222 return ['v8::DEFAULT'] 224 return ['v8::DEFAULT']
223 225
224 226
225 # [NotEnumerable] 227 # [NotEnumerable]
226 def property_attributes(attribute): 228 def property_attributes(attribute):
227 property_attributes_list = [] 229 property_attributes_list = []
228 if 'NotEnumerable' in attribute.extended_attributes: 230 if 'NotEnumerable' in attribute.extended_attributes:
229 property_attributes_list.append('v8::DontEnum') 231 property_attributes_list.append('v8::DontEnum')
230 return property_attributes_list or ['v8::None'] 232 return property_attributes_list or ['v8::None']
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/scripts/unstable/v8_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698