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

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

Issue 74783008: IDL compiler: [ActiveDOMObject] interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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/interface.h » ('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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 'core/dom/ContextFeatures.h', 57 'core/dom/ContextFeatures.h',
58 'core/dom/Document.h', 58 'core/dom/Document.h',
59 'platform/TraceEvent.h', 59 'platform/TraceEvent.h',
60 'wtf/UnusedParam.h', 60 'wtf/UnusedParam.h',
61 ]) 61 ])
62 62
63 63
64 def generate_interface(interface): 64 def generate_interface(interface):
65 includes.clear() 65 includes.clear()
66 includes.update(INTERFACE_CPP_INCLUDES) 66 includes.update(INTERFACE_CPP_INCLUDES)
67 extended_attributes = interface.extended_attributes
67 v8_class_name = v8_utilities.v8_class_name(interface) 68 v8_class_name = v8_utilities.v8_class_name(interface)
68 69
69 template_contents = { 70 template_contents = {
70 'cpp_class_name': cpp_name(interface), 71 'cpp_class_name': cpp_name(interface),
71 'header_includes': INTERFACE_H_INCLUDES, 72 'header_includes': INTERFACE_H_INCLUDES,
72 'interface_name': interface.name, 73 'interface_name': interface.name,
74 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes,
73 'v8_class_name': v8_class_name, 75 'v8_class_name': v8_class_name,
74 } 76 }
75 77
76 template_contents.update({ 78 template_contents.update({
77 'constants': [generate_constant(constant) for constant in interface.cons tants], 79 'constants': [generate_constant(constant) for constant in interface.cons tants],
78 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at tributes, 80 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
79 }) 81 })
80 82
81 attributes = [v8_attributes.generate_attribute(interface, attribute) 83 attributes = [v8_attributes.generate_attribute(interface, attribute)
82 for attribute in interface.attributes] 84 for attribute in interface.attributes]
83 template_contents.update({ 85 template_contents.update({
84 'attributes': attributes, 86 'attributes': attributes,
85 'has_accessors': any(attribute['is_expose_js_accessors'] for attribute i n attributes), 87 'has_accessors': any(attribute['is_expose_js_accessors'] for attribute i n attributes),
86 'has_constructor_attributes': any(attribute['constructor_type'] for attr ibute in attributes), 88 'has_constructor_attributes': any(attribute['constructor_type'] for attr ibute in attributes),
87 'has_per_context_enabled_attributes': any(attribute['per_context_enabled _function_name'] for attribute in attributes), 89 'has_per_context_enabled_attributes': any(attribute['per_context_enabled _function_name'] for attribute in attributes),
88 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib ute in attributes), 90 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib ute in attributes),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 '%s->IsString()' % cpp_value, 220 '%s->IsString()' % cpp_value,
219 '%s->IsObject()' % cpp_value]) 221 '%s->IsObject()' % cpp_value])
220 if v8_types.array_or_sequence_type(idl_type): 222 if v8_types.array_or_sequence_type(idl_type):
221 return '%s->IsArray()' % cpp_value 223 return '%s->IsArray()' % cpp_value
222 if v8_types.is_wrapper_type(idl_type): 224 if v8_types.is_wrapper_type(idl_type):
223 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) 225 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value)
224 if argument['is_nullable']: 226 if argument['is_nullable']:
225 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) 227 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check])
226 return type_check 228 return type_check
227 return None 229 return None
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698