Add missing IWYU message_loop.h includes.
This is a pre-req to removing the dependency from RunLoop->MessageLoop
as many files only include run_loop.h but instantiate a MessageLoop.
The following fix script was applied to each file in the codebase
(plus a few hand fixes for DEPS and for //base):
def Fix(file_path):
content = refactor_lib.ReadFile(file_path)
# Assume fwd-decls are correct in first pass.
if 'class MessageLoop;' in content:
return False
if 'class MessageLoopForUI;' in content:
return False
if 'class MessageLoopForIO;' 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]*base::MessageLoop(ForUI|ForIO)?\b[^*])', re.DOTALL).findall(content)
if not matches:
return False
# Ignore unique pointers in headers in first pass...
if os.path.splitext(file_path)[1] == '.h':
found = False
for match in matches:
if not 'std::unique_ptr<base::MessageLoop' in match[0]:
found = True
break
if not found:
return False
updated_content = refactor_lib.AddInclude(file_path, content, "base/message_loop/message_loop.h")
if updated_content == content:
return False
# Write updated file
refactor_lib.WriteFile(file_path, updated_content)
return True
[email protected]
BUG=703346
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Review-Url: https://codereview.chromium.org/2876013002
Cr-Commit-Position: refs/heads/master@{#471412}
diff --git a/components/update_client/crx_downloader_unittest.cc b/components/update_client/crx_downloader_unittest.cc
index ca9d4c7..aba14b11 100644
--- a/components/update_client/crx_downloader_unittest.cc
+++ b/components/update_client/crx_downloader_unittest.cc
@@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
+#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"