Skip to content
  • Gabriel Charette's avatar
    Automated IWYU fix for TaskRunner includes. · 5ff87ceb
    Gabriel Charette authored
    Pre-requisite to suppress message_loop.h from run_loop.h (issue 703346).
    
    A similar include fix for message_loop.h was done in r471412 but some
    targets are the removal as it looks like they properly didn't need
    message_loop.h but were relying on it to get task runner includes...
    
    The reasoning for this is the same as was once done in https://codereview.chromium.org/2443103003
    (it was then done only on targets that failed to compile instead of via script):
    scoped_refptr<Foo> requires full type of Foo to be defined not just fwd-declared.
    
    Script used:
    
    def Fix(file_path):
      content = refactor_lib.ReadFile(file_path)
    
      if not 'TaskRunner' in content:
        return False
    
      # Assume fwd-decls are correct in first pass.
      if 'class TaskRunner;' in content:
        return False
      if 'class SequencedTaskRunner;' in content:
        return False
      if 'class SingleThreadTaskRunner;' in content:
        return False
    
      # Using base:: prefix ensures we don't match fwd-decls and other th...
    5ff87ceb