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

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

Issue 306543008: Qualify include paths in generated bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: r-b-t and tests Created 6 years, 6 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if base_idl_type.endswith('ConstructorConstructor'): 319 if base_idl_type.endswith('ConstructorConstructor'):
320 # FIXME: rename to NamedConstructor 320 # FIXME: rename to NamedConstructor
321 # FIXME: replace with a [NamedConstructorAttribute] extended attribute 321 # FIXME: replace with a [NamedConstructorAttribute] extended attribute
322 # Ending with 'ConstructorConstructor' indicates a named constructor, 322 # Ending with 'ConstructorConstructor' indicates a named constructor,
323 # and these do not have header files, as they are part of the generated 323 # and these do not have header files, as they are part of the generated
324 # bindings for the interface 324 # bindings for the interface
325 return set() 325 return set()
326 if base_idl_type.endswith('Constructor'): 326 if base_idl_type.endswith('Constructor'):
327 # FIXME: replace with a [ConstructorAttribute] extended attribute 327 # FIXME: replace with a [ConstructorAttribute] extended attribute
328 base_idl_type = idl_type.constructor_type_name 328 base_idl_type = idl_type.constructor_type_name
329 return set(['V8%s.h' % base_idl_type]) 329 return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type],
330 base_idl_type)])
330 331
331 IdlType.includes_for_type = property(includes_for_type) 332 IdlType.includes_for_type = property(includes_for_type)
332 IdlUnionType.includes_for_type = property( 333 IdlUnionType.includes_for_type = property(
333 lambda self: set.union(*[includes_for_type(member_type) 334 lambda self: set.union(*[includes_for_type(member_type)
334 for member_type in self.member_types])) 335 for member_type in self.member_types]))
335 336
336 337
337 def add_includes_for_type(idl_type): 338 def add_includes_for_type(idl_type):
338 includes.update(idl_type.includes_for_type) 339 includes.update(idl_type.includes_for_type)
339 340
340 IdlType.add_includes_for_type = add_includes_for_type 341 IdlType.add_includes_for_type = add_includes_for_type
341 IdlUnionType.add_includes_for_type = add_includes_for_type 342 IdlUnionType.add_includes_for_type = add_includes_for_type
342 343
343 344
344 def includes_for_interface(interface_name): 345 def includes_for_interface(interface_name):
345 return IdlType(interface_name).includes_for_type 346 return IdlType(interface_name).includes_for_type
346 347
347 348
348 def add_includes_for_interface(interface_name): 349 def add_includes_for_interface(interface_name):
349 includes.update(includes_for_interface(interface_name)) 350 includes.update(includes_for_interface(interface_name))
350 351
352 component_dir = {}
353
354
355 def set_component_dirs(new_component_dirs):
356 component_dir.update(new_component_dirs)
357
351 358
352 ################################################################################ 359 ################################################################################
353 # V8 -> C++ 360 # V8 -> C++
354 ################################################################################ 361 ################################################################################
355 362
356 V8_VALUE_TO_CPP_VALUE = { 363 V8_VALUE_TO_CPP_VALUE = {
357 # Basic 364 # Basic
358 'Date': 'toCoreDate({v8_value})', 365 'Date': 'toCoreDate({v8_value})',
359 'DOMString': '{v8_value}', 366 'DOMString': '{v8_value}',
360 'boolean': '{v8_value}->BooleanValue()', 367 'boolean': '{v8_value}->BooleanValue()',
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='', extended_attributes=None): 672 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='', extended_attributes=None):
666 """Returns an expression that converts a C++ value to a V8 value.""" 673 """Returns an expression that converts a C++ value to a V8 value."""
667 # the isolate parameter is needed for callback interfaces 674 # the isolate parameter is needed for callback interfaces
668 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes) 675 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes)
669 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) 676 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes)
670 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] 677 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type]
671 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context) 678 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context)
672 return statement 679 return statement
673 680
674 IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value 681 IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value
OLDNEW
« no previous file with comments | « Source/bindings/scripts/compute_interfaces_info_individual.py ('k') | Source/bindings/tests/idls/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698