parameters: (definitions, component, target_interface, dependency_idl_filenames, reader)
return_statement: return resolved_definitions
docstring: Merge dependencies ('partial interface' and 'implements') in dependency_idl_filenames into target_interface.
  
      Args:
          definitions: IdlDefinitions object, modified in place
          component:
              string, describing where the above definitions are defined,
              'core' or 'modules'. See KNOWN_COMPONENTS in utilities.py
          target_interface: IdlInterface object, modified in place
          dependency_idl_filenames:
              Idl filenames which depend on the above definitions.
          reader: IdlReader object.
      Returns:
          A dictionary whose key is component and value is IdlDefinitions
          object whose dependency is resolved.
docstring_summary: Merge dependencies ('partial interface' and 'implements') in dependency_idl_filenames into target_interface.
docstring_tokens: Merge dependencies ( partial interface and implements ) in dependency_idl_filenames into target_interface .
function: def merge_interface_dependencies(definitions, component, target_interface, dependency_idl_filenames, reader):
      """Merge dependencies ('partial interface' and 'implements') in dependency_idl_filenames into target_interface.
  
      Args:
          definitions: IdlDefinitions object, modified in place
          component:
              string, describing where the above definitions are defined,
              'core' or 'modules'. See KNOWN_COMPONENTS in utilities.py
          target_interface: IdlInterface object, modified in place
          dependency_idl_filenames:
              Idl filenames which depend on the above definitions.
          reader: IdlReader object.
      Returns:
          A dictionary whose key is component and value is IdlDefinitions
          object whose dependency is resolved.
      """
      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)
          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)
  
          # We need to use different checkdeps here for partial interface and
          # inheritance.
          if dependency_interface.is_partial:
              # Case: dependency_interface is a partial interface of
              # target_interface.
              # So,
              # - A partial interface defined in modules can update
              #   the original interface defined in core.
              # However,
              # - A partial interface defined in core cannot update
              #   the original interface defined in modules.
              if not is_valid_component_dependency(dependency_component, component):
                  raise Exception('The partial interface:%s in %s cannot update '
                                  'the original interface:%s in %s' % (dependency_interface.name,
                                                                       dependency_component,
                                                                       target_interface.name,
                                                                       component))
  
              if dependency_component in resolved_definitions:
                  # When merging a new partial interfaces, should not overwrite
                  # ImpelemntedAs extended attributes in merged partial
                  # interface.
                  # See also the below "if 'ImplementedAs' not in ... " line's
                  # comment.
                  dependency_interface.extended_attributes.pop('ImplementedAs', None)
                  resolved_definitions[dependency_component].update(dependency_definitions)
                  continue
  
              dependency_interface.extended_attributes.update(target_interface.extended_attributes)
              assert target_interface == definitions.interfaces[dependency_interface.name]
              # A partial interface should use its original interface's
              # ImplementedAs. If the original interface doesn't have,
              # remove ImplementedAs defined in the partial interface.
              # Because partial interface needs the original interface's
              # cpp class to obtain partial interface's cpp class.
              # e.g.. V8WindowPartial.cpp:
              #   DOMWindow* impl = V8Window::toImpl(holder);
              #   RawPtr<...> cppValue(DOMWindowQuota::webkitStorageInfo(impl));
              # TODO(tasak): remove ImplementedAs extended attributes
              # from all partial interfaces. Instead, rename all cpp/header
              # files correctly. ImplementedAs should not be allowed in
              # partial interfaces.
              if 'ImplementedAs' not in target_interface.extended_attributes:
                  dependency_interface.extended_attributes.pop('ImplementedAs', None)
              dependency_interface.original_interface = target_interface
              target_interface.partial_interfaces.append(dependency_interface)
              resolved_definitions[dependency_component] = dependency_definitions
          else:
              # Case: target_interface implements dependency_interface.
              # So,
              # - An interface defined in modules can implement some interface
              #   defined in core.
              #   In this case, we need "NoInterfaceObject" extended attribute.
              # However,
              # - An interface defined in core cannot implement any interface
              #   defined in modules.
              if not is_valid_component_dependency(component, dependency_component):
                  raise Exception('The interface:%s in %s cannot implement '
                                  'the interface:%s in %s.' % (dependency_interface.name,
                                                               dependency_component,
                                                               target_interface.name,
                                                               component))
  
              if component != dependency_component and 'NoInterfaceObject' not in dependency_interface.extended_attributes:
                  raise Exception('The interface:%s in %s cannot implement '
                                  'the interface:%s in %s because of '
                                  'missing NoInterfaceObject.' % (dependency_interface.name,
                                                                  dependency_component,
                                                                  target_interface.name,
                                                                  component))
  
              resolved_definitions[component].update(dependency_definitions)  # merges partial interfaces
              # 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)
  
      return resolved_definitions
function_tokens: def merge_interface_dependencies ( definitions , component , target_interface , dependency_idl_filenames , reader ) : 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 ) 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 ) # We need to use different checkdeps here for partial interface and # inheritance. if dependency_interface . is_partial : # Case: dependency_interface is a partial interface of # target_interface. # So, # - A partial interface defined in modules can update #   the original interface defined in core. # However, # - A partial interface defined in core cannot update #   the original interface defined in modules. if not is_valid_component_dependency ( dependency_component , component ) : raise Exception ( 'The partial interface:%s in %s cannot update ' 'the original interface:%s in %s' % ( dependency_interface . name , dependency_component , target_interface . name , component ) ) if dependency_component in resolved_definitions : # When merging a new partial interfaces, should not overwrite # ImpelemntedAs extended attributes in merged partial # interface. # See also the below "if 'ImplementedAs' not in ... " line's # comment. dependency_interface . extended_attributes . pop ( 'ImplementedAs' , None ) resolved_definitions [ dependency_component ] . update ( dependency_definitions ) continue dependency_interface . extended_attributes . update ( target_interface . extended_attributes ) assert target_interface == definitions . interfaces [ dependency_interface . name ] # A partial interface should use its original interface's # ImplementedAs. If the original interface doesn't have, # remove ImplementedAs defined in the partial interface. # Because partial interface needs the original interface's # cpp class to obtain partial interface's cpp class. # e.g.. V8WindowPartial.cpp: #   DOMWindow* impl = V8Window::toImpl(holder); #   RawPtr<...> cppValue(DOMWindowQuota::webkitStorageInfo(impl)); # TODO(tasak): remove ImplementedAs extended attributes # from all partial interfaces. Instead, rename all cpp/header # files correctly. ImplementedAs should not be allowed in # partial interfaces. if 'ImplementedAs' not in target_interface . extended_attributes : dependency_interface . extended_attributes . pop ( 'ImplementedAs' , None ) dependency_interface . original_interface = target_interface target_interface . partial_interfaces . append ( dependency_interface ) resolved_definitions [ dependency_component ] = dependency_definitions else : # Case: target_interface implements dependency_interface. # So, # - An interface defined in modules can implement some interface #   defined in core. #   In this case, we need "NoInterfaceObject" extended attribute. # However, # - An interface defined in core cannot implement any interface #   defined in modules. if not is_valid_component_dependency ( component , dependency_component ) : raise Exception ( 'The interface:%s in %s cannot implement ' 'the interface:%s in %s.' % ( dependency_interface . name , dependency_component , target_interface . name , component ) ) if component != dependency_component and 'NoInterfaceObject' not in dependency_interface . extended_attributes : raise Exception ( 'The interface:%s in %s cannot implement ' 'the interface:%s in %s because of ' 'missing NoInterfaceObject.' % ( dependency_interface . name , dependency_component , target_interface . name , component ) ) resolved_definitions [ component ] . update ( dependency_definitions ) # merges partial interfaces # 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 ) return resolved_definitions