Skip to content

Commit

Permalink
IWYU for callback_helpers.h
Browse files Browse the repository at this point in the history
Prereq for https://chromium-review.googlesource.com/c/chromium/src/+/2773408
as we previously had
task_traits.h=>thread_pool.h=>callback_helpers.h

Users that should be including thread_pool.h explicitly did so in
https://chromium-review.googlesource.com/c/chromium/src/+/2775891

These are the remaining users of types in callback_helpers.h that
weren't properly IWYU. e.g.:
../../media/video/software_video_encoder_test.cc:92:54: error: no member named 'NullCallback' in namespace 'base'
std::move(output_cb), base::NullCallback());

Script:

def Fix(file_path):
  content = refactor_lib.ReadFile(file_path)

  # Assume fwd-decls are correct in first pass.
  if 'class ScopedClosureRunner;' in content:
    return False

  # Using base:: prefix ensures we don't match fwd-decls and other
  # things. Will require a few fixups for missing includes in //base
  # proper. Complex prefix in regex attempts to skip comments.
  matches = re.compile(
      r'(\n *[^/\n][^/\n][^/\n]*'
      r'(base::ScopedClosureRunner|base::NullCallback|base::DoNothing)'
      r'\b[^*])',
      re.DOTALL).findall(content)

  if not matches:
    return False

  updated_content = refactor_lib.AddInclude(file_path, content,
                                            "base/callback_helpers.h")

  if updated_content == content:
    return False

  # Write updated file
  refactor_lib.WriteFile(file_path, updated_content)

  return True

Bug: 1026641
Change-Id: Ic7cfec226f1a13b05f4244d5ffcdd2ad8c4e4c3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2774781
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: François Doray <fdoray@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#865177}
  • Loading branch information
Gabriel Charette authored and Chromium LUCI CQ committed Mar 22, 2021
1 parent f728fe0 commit a6b6f55
Show file tree
Hide file tree
Showing 325 changed files with 325 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef ANDROID_WEBVIEW_BROWSER_GFX_SKIA_OUTPUT_SURFACE_DEPENDENCY_WEBVIEW_H_
#define ANDROID_WEBVIEW_BROWSER_GFX_SKIA_OUTPUT_SURFACE_DEPENDENCY_WEBVIEW_H_

#include "base/callback_helpers.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
Expand Down
1 change: 1 addition & 0 deletions ash/app_list/app_list_controller_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "ash/shell_observer.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_observer.h"
#include "base/callback_helpers.h"
#include "base/observer_list.h"
#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/sync/model/string_ordinal.h"
Expand Down
1 change: 1 addition & 0 deletions ash/display/privacy_screen_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/callback_helpers.h"
#include "components/prefs/pref_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/display/fake/fake_display_snapshot.h"
Expand Down
1 change: 1 addition & 0 deletions ash/login/security_token_request_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ash/public/cpp/login_types.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/i18n/number_formatting.h"
#include "chromeos/components/security_token_pin/error_generator.h"
#include "ui/base/l10n/l10n_util.h"
Expand Down
1 change: 1 addition & 0 deletions ash/login/ui/pin_request_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "ash/public/cpp/login_types.h"
#include "ash/public/cpp/tablet_mode_observer.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/callback_helpers.h"
#include "base/scoped_observation.h"
#include "ui/views/window/dialog_delegate.h"

Expand Down
1 change: 1 addition & 0 deletions ash/shelf/drag_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "ash/wm/overview/overview_observer.h"
#include "ash/wm/splitview/split_view_controller.h"
#include "ash/wm/splitview/split_view_observer.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "base/timer/timer.h"
Expand Down
1 change: 1 addition & 0 deletions ash/shelf/login_shelf_gesture_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "base/callback_helpers.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"

namespace ash {
Expand Down
1 change: 1 addition & 0 deletions ash/shelf/login_shelf_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/run_loop.h"
#include "ui/display/manager/display_configurator.h"
Expand Down
1 change: 1 addition & 0 deletions ash/shelf/scrollable_shelf_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "ash/shelf/shelf_container_view.h"
#include "ash/shelf/shelf_tooltip_delegate.h"
#include "ash/shelf/shelf_view.h"
#include "base/callback_helpers.h"
#include "base/cancelable_callback.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/views/animation/ink_drop_host_view.h"
Expand Down
1 change: 1 addition & 0 deletions ash/shelf/shelf_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "ash/shelf/shelf_component.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shelf/shelf_observer.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "ui/views/widget/widget.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "ash/system/accessibility/tray_accessibility.h"
#include "ash/test/ash_test_base.h"
#include "base/barrier_closure.h"
#include "base/callback_helpers.h"

namespace ash {

Expand Down
1 change: 1 addition & 0 deletions ash/system/holding_space/downloads_section.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "ash/system/holding_space/holding_space_item_chips_container.h"
#include "ash/system/holding_space/holding_space_util.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "ash/system/holding_space/holding_space_item_view.h"
#include "ash/system/holding_space/holding_space_tray_bubble.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "net/base/mime_util.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.mojom.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ash/system/holding_space/holding_space_item_view_delegate.h"
#include "ash/system/holding_space/holding_space_util.h"
#include "base/auto_reset.h"
#include "base/callback_helpers.h"
#include "ui/compositor/callback_layer_animation_observer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/layer_animator.h"
Expand Down
1 change: 1 addition & 0 deletions ash/system/holding_space/pinned_files_section.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ash/system/holding_space/holding_space_item_chip_view.h"
#include "ash/system/holding_space/holding_space_item_chips_container.h"
#include "ash/system/holding_space/holding_space_util.h"
#include "base/callback_helpers.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
Expand Down
1 change: 1 addition & 0 deletions ash/system/power/power_button_menu_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "ash/system/user/login_status.h"
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/callback_helpers.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
Expand Down
1 change: 1 addition & 0 deletions base/task/thread_pool/worker_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <utility>

#include "base/callback_helpers.h"
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vector>

#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/apps/app_service/plugin_vm_apps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>

#include "ash/public/cpp/app_menu_constants.h"
#include "base/callback_helpers.h"
#include "base/metrics/user_metrics.h"
#include "base/time/time.h"
#include "chrome/browser/apps/app_service/app_icon_factory.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/apps/app_shim/app_shim_manager_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "apps/app_lifetime_monitor_factory.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/hash/sha1.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/arc/adbd/arc_adbd_monitor_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/borealis/borealis_installer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <memory>

#include "base/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ash/borealis/borealis_context_manager.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/borealis/borealis_task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <string>

#include "ash/constants/ash_features.h"
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/crosapi/browser_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "ash/strings/grit/ash_strings.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/crosapi/prefs_ash_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <memory>

#include "ash/public/cpp/ash_pref_names.h"
#include "base/callback_helpers.h"
#include "base/optional.h"
#include "base/test/bind.h"
#include "chrome/test/base/scoped_testing_local_state.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/ash/login/app_mode/kiosk_launch_controller.h"

#include "base/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/syslog_logging.h"
#include "chrome/browser/ash/app_mode/arc/arc_kiosk_app_manager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <vector>

#include "base/callback_helpers.h"
#include "base/run_loop.h"
#include "base/scoped_observer.h"
#include "base/test/bind.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "chrome/browser/ash/login/screens/update_required_screen.h"

#include "ash/constants/ash_switches.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/optional.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "ash/public/cpp/notification_utils.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/notreached.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/login/session/user_session_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "ash/public/cpp/ash_features.h"
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/location.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/ash/login/session/user_session_manager.h"

#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h"

#include "ash/public/cpp/shelf_model.h"
#include "base/callback_helpers.h"
#include "base/files/file_util.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <algorithm>

#include "base/callback_helpers.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/banners/app_banner_manager_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/run_loop.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/browsing_data/access_context_audit_service.h"

#include "base/callback_helpers.h"
#include "base/files/scoped_temp_dir.h"
#include "base/i18n/time_formatting.h"
#include "base/task/thread_pool.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>

#include "base/barrier_closure.h"
#include "base/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "ash/public/cpp/notification_utils.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/notifications/notification_display_service.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chromeos/crostini/termina_installer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/barrier_closure.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/task_traits.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "ash/constants/ash_features.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string>
#include <vector>

#include "base/callback_helpers.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/chromeos/file_manager/file_tasks.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/chromeos/fileapi/file_change_service.h"

#include "base/callback_helpers.h"
#include "base/files/scoped_temp_dir.h"
#include "base/scoped_observation.h"
#include "base/test/bind.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/chromeos/guest_os/guest_os_external_protocol_handler.h"

#include "base/callback_helpers.h"
#include "base/time/time.h"
#include "chrome/browser/ash/borealis/borealis_app_launcher.h"
#include "chrome/browser/ash/borealis/borealis_service.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/input_method/native_input_method_engine.h"

#include "ash/constants/ash_features.h"
#include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "chrome/browser/chromeos/input_method/stub_input_method_engine_observer.h"
#include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client_test_helper.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chromeos/policy/bluetooth_policy_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/policy/bluetooth_policy_handler.h"

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "chromeos/settings/cros_settings_names.h"
#include "chromeos/settings/cros_settings_provider.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/policy/dlp/dlp_content_manager.h"

#include "ash/public/cpp/ash_features.h"
#include "base/callback_helpers.h"
#include "base/json/json_writer.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "base/base64.h"
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/feature_list.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/check.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/lite_video/lite_video_decider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/lite_video/lite_video_decider.h"

#include "base/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/histogram_macros_local.h"
#include "base/optional.h"
Expand Down
Loading

0 comments on commit a6b6f55

Please sign in to comment.