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

Unified Diff: Source/bindings/scripts/interface_dependency_resolver.py

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed http/tests/serviceworker/fetch\* regression Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/interface_dependency_resolver.py
diff --git a/Source/bindings/scripts/interface_dependency_resolver.py b/Source/bindings/scripts/interface_dependency_resolver.py
index 7bf3b05c0598a715152d0b5e5ce6038479a9afae..9c130778cd71b23ba06126cc11d25e9692c443c3 100644
--- a/Source/bindings/scripts/interface_dependency_resolver.py
+++ b/Source/bindings/scripts/interface_dependency_resolver.py
@@ -37,6 +37,7 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC
"""
import os.path
+from utilities import idl_filename_to_component, is_valid_component_dependency
# The following extended attributes can be applied to a dependency interface,
# and are then applied to the individual members when merging.
@@ -110,26 +111,30 @@ class InterfaceDependencyResolver(object):
target_interface.extended_attributes.update(
interface_info['inherited_extended_attributes'])
+ # FIXME: new method for partial interface dependencies full paths?
resolved_definitions = merge_interface_dependencies(
definitions,
component,
target_interface,
- interface_info['dependencies_full_paths'],
+ interface_info['dependencies_full_paths'] +
+ interface_info['partial_interface_dependencies_full_paths'],
self.reader)
for referenced_interface_name in interface_info['referenced_interfaces']:
referenced_definitions = self.reader.read_idl_definitions(
self.interfaces_info[referenced_interface_name]['full_path'])
- if component not in referenced_definitions:
- raise Exception('This definitions: %s is defined in %s '
- 'but reference interface:%s is not defined '
- 'in %s' % (definitions.idl_name,
- component,
- referenced_interface_name,
- component))
+ for referenced_component in referenced_definitions:
+ if not is_valid_component_dependency(component, referenced_component):
+ raise Exception('This definitions: %s is defined in %s '
+ 'but reference interface:%s is defined '
+ 'in %s' % (definitions.idl_name,
+ component,
+ referenced_interface_name,
+ referenced_component))
+
+ resolved_definitions[component].update(referenced_definitions[component])
- resolved_definitions[component].update(referenced_definitions[component])
return resolved_definitions
@@ -138,28 +143,41 @@ def merge_interface_dependencies(definitions, component, target_interface, depen
No return: modifies target_interface in place.
"""
+ resolved_definitions = {component: definitions}
# Sort so order consistent, so can compare output from run to run.
for dependency_idl_filename in sorted(dependency_idl_filenames):
dependency_definitions = reader.read_idl_file(dependency_idl_filename)
- # FIXME(crbug.com/358074): should not merge core definitions with
- # modules definitions.
+ dependency_component = idl_filename_to_component(dependency_idl_filename)
+
dependency_interface = next(dependency_definitions.interfaces.itervalues())
dependency_interface_basename, _ = os.path.splitext(os.path.basename(dependency_idl_filename))
transfer_extended_attributes(dependency_interface,
dependency_interface_basename)
- definitions.update(dependency_definitions) # merges partial interfaces
+
+ if not is_valid_component_dependency(component, dependency_component) and dependency_interface.is_partial:
haraken 2014/10/09 04:24:00 Would you elaborate on what this is doing? Why do
tasak 2014/10/10 07:52:22 Done.
+ if dependency_component in resolved_definitions:
+ resolved_definitions[dependency_component].update(dependency_definitions)
+ continue
+
+ extended_attributes = {}
+ extended_attributes.update(target_interface.extended_attributes)
+ extended_attributes.update(dependency_interface.extended_attributes)
+ dependency_interface.extended_attributes.update(extended_attributes)
+ assert target_interface == definitions.interfaces[dependency_interface.name]
+ dependency_interface.original_interface = target_interface
+ target_interface.partial_interfaces.append(dependency_interface)
+ resolved_definitions[dependency_component] = dependency_definitions
+ continue
+
+ resolved_definitions[component].update(dependency_definitions) # merges partial interfaces
if not dependency_interface.is_partial:
# Implemented interfaces (non-partial dependencies) are also merged
# into the target interface, so Code Generator can just iterate
# over one list (and not need to handle 'implements' itself).
target_interface.merge(dependency_interface)
- # FIXME: Currently, this function just returns one IdlDefinitions
- # instance. However, for partial interface modularization, we need to
- # make this function return multiple definitions, i.e.
- # { 'core': ..., 'modules': ... }.
- return {component: definitions}
+ return resolved_definitions
def transfer_extended_attributes(dependency_interface, dependency_interface_basename):

Powered by Google App Engine
This is Rietveld 408576698