Commit 817e6c6c authored by nbarth@chromium.org's avatar nbarth@chromium.org

Remove [NoHeader] interface extended attribute

Perl cruft: Python compiler assumes a header file exists.
This removes a special case and simplifies CG logic by having stub header
files if needed.

R=haraken
BUG=341748

Review URL: https://codereview.chromium.org/208393014

git-svn-id: svn://svn.chromium.org/blink/trunk@169906 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3b4dcb48
...@@ -64,8 +64,6 @@ ImplementedInBaseClass ...@@ -64,8 +64,6 @@ ImplementedInBaseClass
InitializedByEventConstructor InitializedByEventConstructor
MeasureAs=* MeasureAs=*
NamedConstructor=* NamedConstructor=*
# FIXME: remove [NoHeader] once switch to Python
NoHeader
NoInterfaceObject NoInterfaceObject
NotEnumerable NotEnumerable
OverrideBuiltins OverrideBuiltins
......
...@@ -112,6 +112,14 @@ ...@@ -112,6 +112,14 @@
'<(SHARED_INTERMEDIATE_DIR)/ServiceWorkerGlobalScopeConstructors.idl', '<(SHARED_INTERMEDIATE_DIR)/ServiceWorkerGlobalScopeConstructors.idl',
], ],
'generated_global_constructors_header_files': [
'<(SHARED_INTERMEDIATE_DIR)/blink/WindowConstructors.h',
'<(SHARED_INTERMEDIATE_DIR)/blink/WorkerGlobalScopeConstructors.h',
'<(SHARED_INTERMEDIATE_DIR)/blink/SharedWorkerGlobalScopeConstructors.h',
'<(SHARED_INTERMEDIATE_DIR)/blink/DedicatedWorkerGlobalScopeConstructors.h',
'<(SHARED_INTERMEDIATE_DIR)/ServiceWorkerGlobalScopeConstructors.h',
],
# Python source # Python source
'jinja_module_files': [ 'jinja_module_files': [
...@@ -195,6 +203,7 @@ ...@@ -195,6 +203,7 @@
], ],
'outputs': [ 'outputs': [
'<@(generated_global_constructors_idl_files)', '<@(generated_global_constructors_idl_files)',
'<@(generated_global_constructors_header_files)',
], ],
'action': [ 'action': [
'python', 'python',
......
...@@ -161,10 +161,8 @@ def compute_individual_info(idl_filename): ...@@ -161,10 +161,8 @@ def compute_individual_info(idl_filename):
extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents) extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
implemented_as = extended_attributes.get('ImplementedAs') implemented_as = extended_attributes.get('ImplementedAs')
# FIXME: remove [NoHeader] once switch to Python
this_include_path = (include_path(idl_filename, implemented_as) this_include_path = (include_path(idl_filename, implemented_as)
if ('ImplementedInBaseClass' not in extended_attributes if 'ImplementedInBaseClass' not in extended_attributes
and 'NoHeader' not in extended_attributes)
else None) else None)
# Handle partial interfaces # Handle partial interfaces
......
...@@ -26,6 +26,12 @@ from utilities import get_file_contents, write_file, get_interface_extended_attr ...@@ -26,6 +26,12 @@ from utilities import get_file_contents, write_file, get_interface_extended_attr
global_objects = {} global_objects = {}
HEADER_FORMAT = """
// Stub header file for {{idl_basename}}
// Required because the IDL compiler assumes that a corresponding header file
// exists for each IDL file.
"""
def parse_options(): def parse_options():
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.add_option('--idl-files-list', help='file listing IDL files') parser.add_option('--idl-files-list', help='file listing IDL files')
...@@ -92,17 +98,18 @@ def generate_global_constructors_list(interface_name, extended_attributes): ...@@ -92,17 +98,18 @@ def generate_global_constructors_list(interface_name, extended_attributes):
return attributes_list return attributes_list
def write_global_constructors_partial_interface(interface_name, destination_filename, constructor_attributes_list, only_if_changed): def write_global_constructors_partial_interface(interface_name, idl_filename, constructor_attributes_list, only_if_changed):
# FIXME: replace this with a simple Jinja template # FIXME: replace this with a simple Jinja template
lines = (['[\n'] + lines = (['partial interface %s {\n' % interface_name] +
[' NoHeader,\n'] +
[']\n'] +
['partial interface %s {\n' % interface_name] +
[' %s;\n' % constructor_attribute [' %s;\n' % constructor_attribute
# FIXME: sort by interface name (not first by extended attributes) # FIXME: sort by interface name (not first by extended attributes)
for constructor_attribute in sorted(constructor_attributes_list)] + for constructor_attribute in sorted(constructor_attributes_list)] +
['};\n']) ['};\n'])
write_file(''.join(lines), destination_filename, only_if_changed) write_file(''.join(lines), idl_filename, only_if_changed)
header_filename = os.path.splitext(idl_filename)[0] + '.h'
idl_basename = os.path.basename(idl_filename)
write_file(HEADER_FORMAT.format(idl_basename=idl_basename),
header_filename, only_if_changed)
################################################################################ ################################################################################
...@@ -119,20 +126,24 @@ def main(): ...@@ -119,20 +126,24 @@ def main():
# these are in the build directory, which is determined at build time, not # these are in the build directory, which is determined at build time, not
# GYP time. # GYP time.
# These are passed as pairs of GlobalObjectName, GlobalObject.idl # These are passed as pairs of GlobalObjectName, GlobalObject.idl
interface_name_filename = [(args[i], args[i + 1]) interface_name_idl_filename = [(args[i], args[i + 1])
for i in range(0, len(args), 2)] for i in range(0, len(args), 2)]
global_objects.update( global_objects.update(
(interface_name, { (interface_name, {
'filename': filename, 'idl_filename': idl_filename,
'constructors': [], 'constructors': [],
}) })
for interface_name, filename in interface_name_filename) for interface_name, idl_filename in interface_name_idl_filename)
for idl_filename in idl_files: for idl_filename in idl_files:
record_global_constructors(idl_filename) record_global_constructors(idl_filename)
for interface_name, global_object in global_objects.iteritems(): for interface_name, global_object in global_objects.iteritems():
write_global_constructors_partial_interface(interface_name, global_object['filename'], global_object['constructors'], options.write_file_only_if_changed) write_global_constructors_partial_interface(
interface_name,
global_object['idl_filename'],
global_object['constructors'],
options.write_file_only_if_changed)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
[ [
ImplementedAs=TestPartialInterfacePythonImplementation, // Conflicts with default partial interface class name ImplementedAs=TestPartialInterfacePythonImplementation, // Conflicts with default partial interface class name
// NoHeader, // FIXME: remove this attribute once switch to Python, as removing; only needed by Python (and not supported by Perl), so no test currently
// PerContextEnabled=PartialContextName, // Conflicts with [RuntimeEnabled]; test disabled because Perl behavior is wrong for static attributes and methods and only one actual use // PerContextEnabled=PartialContextName, // Conflicts with [RuntimeEnabled]; test disabled because Perl behavior is wrong for static attributes and methods and only one actual use
] partial interface TestInterfacePython { ] partial interface TestInterfacePython {
const unsigned short PARTIAL2_UNSIGNED_SHORT = 0; const unsigned short PARTIAL2_UNSIGNED_SHORT = 0;
......
// Stub header file, required by IDL compiler due to existence
// of WindowMediaSource.idl (corresponding header assumed to exist).
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
*/ */
[ [
NoHeader,
RuntimeEnabled=WebKitMediaSource, RuntimeEnabled=WebKitMediaSource,
] partial interface Window { ] partial interface Window {
attribute WebKitMediaSourceConstructor WebKitMediaSource; attribute WebKitMediaSourceConstructor WebKitMediaSource;
......
...@@ -463,6 +463,7 @@ ...@@ -463,6 +463,7 @@
'mediasource/WebKitSourceBuffer.h', 'mediasource/WebKitSourceBuffer.h',
'mediasource/WebKitSourceBufferList.cpp', 'mediasource/WebKitSourceBufferList.cpp',
'mediasource/WebKitSourceBufferList.h', 'mediasource/WebKitSourceBufferList.h',
'mediasource/WindowMediaSource.h',
'mediastream/MediaConstraintsImpl.cpp', 'mediastream/MediaConstraintsImpl.cpp',
'mediastream/MediaConstraintsImpl.h', 'mediastream/MediaConstraintsImpl.h',
'mediastream/MediaDeviceInfo.cpp', 'mediastream/MediaDeviceInfo.cpp',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment