Remove calls to deprecated MessageLoop methods in ipc.
This CL makes the following replacements in
ipc:
Before After
----------------------------------------------------------
x.PostTask() x.task_runner()->PostTask()
PostDelayedTask() PostDelayedTask()
ReleaseSoon() ReleaseSoon()
DeleteSoon() DeleteSoon()
x->PostTask() y->task_runner()->PostTask()
PostDelayedTask() PostDelayedTask()
ReleaseSoon() ReleaseSoon()
DeleteSoon() DeleteSoon()
x.Run() RunLoop().Run()
x.RunUntilIdle() RunLoop().RunUntilIdle()
x->Run() RunLoop().Run()
x->RunUntilIdle() RunLoop().RunUntilIdle()
If |y| isn't MessageLoopForUI::current() or
MessageLoopForIO::current()
y.message_loop()->task_runner()
y.task_runner()
y->message_loop()->task_runner()
y->task_runner()
----------------------------------------------------------
|x| is a base::MessageLoop(ForUI|ForIO) or a pointer to
a base::MessageLoop(ForUI|ForIO). |y| is a base::Thread
or a pointer to a base::Thread.
This CL was generated using the MessageLoopDeprecatedMethods
clang-tidy fix available on the associated bug. Only files
that compile on Mac are affected. Follow-up CLs will make
these replacements for other platforms.
This CL doesn't change code behavior.
BUG=616447
R=jam@chromium.org
Review-Url: https://codereview.chromium.org/2087163003
Cr-Commit-Position: refs/heads/master@{#401385}
diff --git a/ipc/attachment_broker_mac_unittest.cc b/ipc/attachment_broker_mac_unittest.cc
index 3be3d439..62b7d113 100644
--- a/ipc/attachment_broker_mac_unittest.cc
+++ b/ipc/attachment_broker_mac_unittest.cc
@@ -20,6 +20,7 @@
#include "base/mac/mach_logging.h"
#include "base/memory/free_deleter.h"
#include "base/memory/shared_memory.h"
+#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/spin_wait.h"
#include "base/time/time.h"
@@ -584,7 +585,7 @@
while (true) {
if (globals->message_logging)
LOG(INFO) << "Privileged process spinning run loop.";
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
ProxyListener::Reason reason = listener.get_reason();
if (reason == ProxyListener::CHANNEL_ERROR)
break;
@@ -613,7 +614,7 @@
CommonSetUp("SendSharedMemoryHandle");
SendMessage1(kDataBuffer1);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -636,7 +637,7 @@
std::string buffer(1 << 23, 'a');
SendMessage1(buffer);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -660,7 +661,7 @@
SendMessage1(kDataBuffer1);
SendMessage1(kDataBuffer2);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -701,7 +702,7 @@
}
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -745,7 +746,7 @@
shared_memory1->handle(), shared_memory2->handle());
sender()->Send(message);
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -786,7 +787,7 @@
shared_memory->handle(), shared_memory->handle());
sender()->Send(message);
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -841,7 +842,7 @@
sender()->Send(message);
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -899,10 +900,10 @@
sender()->Send(message);
// Wait until the child process has sent this process a message.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Wait for any asynchronous activity to complete.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Get the received attachment.
IPC::BrokerableAttachment::AttachmentId* id = get_observer()->get_id();
@@ -964,7 +965,7 @@
get_proxy_listener()->set_listener(get_result_listener());
SendMessage1(kDataBuffer1);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CheckChildResult();
@@ -1006,7 +1007,7 @@
sender()->Send(message);
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -1036,7 +1037,7 @@
sender()->Send(message);
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -1105,10 +1106,10 @@
int received_message_count = 0;
while (received_message_count < kMessagesToTest) {
// Wait until the child process has sent this process a message.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Wait for any asynchronous activity to complete.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
while (get_proxy_listener()->has_message()) {
get_proxy_listener()->pop_first_message();
@@ -1173,7 +1174,7 @@
std::string test_string(g_large_message_size, 'a');
SendMessage1(test_string);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
@@ -1229,11 +1230,11 @@
std::fill(message.begin() + end, message.end(), 'a');
SendMessage1(message);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
if (get_result_listener()->get_result() == RESULT_UNKNOWN)
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
CommonTearDown();
}
diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc
index 0ed6679..830ea30 100644
--- a/ipc/ipc_channel_posix_unittest.cc
+++ b/ipc/ipc_channel_posix_unittest.cc
@@ -23,6 +23,7 @@
#include "base/path_service.h"
#include "base/posix/eintr_wrapper.h"
#include "base/process/process.h"
+#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
@@ -177,7 +178,7 @@
// current run loop on any channel activity.
loop->task_runner()->PostDelayedTask(FROM_HERE, loop->QuitWhenIdleClosure(),
delay);
- loop->Run();
+ base::RunLoop().Run();
}
TEST_F(IPCChannelPosixTest, BasicListen) {
diff --git a/ipc/ipc_channel_proxy_unittest.cc b/ipc/ipc_channel_proxy_unittest.cc
index 5367157e..75e6b95b 100644
--- a/ipc/ipc_channel_proxy_unittest.cc
+++ b/ipc/ipc_channel_proxy_unittest.cc
@@ -9,6 +9,7 @@
#include <memory>
#include "base/pickle.h"
+#include "base/run_loop.h"
#include "base/threading/thread.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_test_base.h"
@@ -260,7 +261,7 @@
void SendQuitMessageAndWaitForIdle() {
sender()->Send(new WorkerMsg_Quit);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
EXPECT_TRUE(WaitForClientShutdown());
}
@@ -400,7 +401,7 @@
void SendQuitMessageAndWaitForIdle() {
sender()->Send(new WorkerMsg_Quit);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
EXPECT_TRUE(WaitForClientShutdown());
}
@@ -431,7 +432,7 @@
CHECK(channel->Connect());
listener.Init(channel.get());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
return 0;
}
diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc
index e423b89..f5ee206 100644
--- a/ipc/ipc_channel_unittest.cc
+++ b/ipc/ipc_channel_unittest.cc
@@ -14,6 +14,7 @@
#include <string>
#include "base/pickle.h"
+#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread.h"
@@ -38,7 +39,7 @@
IPC::TestChannelListener::SendOneMessage(sender(), "hello from parent");
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Close the channel so the client's OnChannelError() gets fired.
channel()->Close();
@@ -105,7 +106,7 @@
IPC::TestChannelListener::SendOneMessage(sender(), "hello from parent");
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
EXPECT_TRUE(WaitForClientShutdown());
@@ -145,7 +146,7 @@
IPC::TestChannelListener::SendOneMessage(sender(), "hello from parent");
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Close the channel so the client's OnChannelError() gets fired.
channel()->Close();
@@ -165,7 +166,7 @@
listener.Init(channel.get());
IPC::TestChannelListener::SendOneMessage(channel.get(), "hello from child");
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
return 0;
}
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index f197a6b..373b2a7 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -11,6 +11,7 @@
#include <string>
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
@@ -244,7 +245,7 @@
private:
bool MsgHandlerInternal(uint32_t type_id) {
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
if (NULL == last_msg_)
return false;
if (FUZZER_ROUTING_ID != last_msg_->routing_id())
@@ -264,7 +265,7 @@
IPCTestBase::GetChannelName("FuzzServerClient"), &listener));
CHECK(channel->Connect());
listener.Init(channel.get());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
return 0;
}
diff --git a/ipc/ipc_perftest_support.cc b/ipc/ipc_perftest_support.cc
index 050b541..2932ce8 100644
--- a/ipc/ipc_perftest_support.cc
+++ b/ipc/ipc_perftest_support.cc
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/pickle.h"
+#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/perf_time_logger.h"
#include "base/test/test_io_thread.h"
@@ -269,7 +270,7 @@
sender()->Send(message);
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
}
// Send quit message.
@@ -309,7 +310,7 @@
sender()->Send(message);
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
}
// Send quit message.
@@ -344,7 +345,7 @@
listener_->Init(channel.get());
CHECK(channel->Connect());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
return 0;
}
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc
index 3b0e7b3..a656015 100644
--- a/ipc/ipc_send_fds_test.cc
+++ b/ipc/ipc_send_fds_test.cc
@@ -24,6 +24,7 @@
#include "base/location.h"
#include "base/pickle.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "ipc/ipc_message_attachment_set.h"
@@ -133,7 +134,7 @@
}
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Close the channel so the client's OnChannelError() gets fired.
channel()->Close();
@@ -159,7 +160,7 @@
CHECK(channel->Connect());
// Run message loop.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Verify that the message loop was exited due to getting the correct number
// of descriptors, and not because of the channel closing unexpectedly.
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index 6a9bd77f..1504590 100644
--- a/ipc/ipc_sync_channel_unittest.cc
+++ b/ipc/ipc_sync_channel_unittest.cc
@@ -200,7 +200,7 @@
base::RunLoop().RunUntilIdle();
- ipc_thread_.message_loop()->PostTask(
+ ipc_thread_.task_runner()->PostTask(
FROM_HERE, base::Bind(&Worker::OnIPCThreadShutdown, this,
listener_event, ipc_event));
}
diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc
index 744d37c8..ce1dbb18e 100644
--- a/ipc/mojo/ipc_channel_mojo_unittest.cc
+++ b/ipc/mojo/ipc_channel_mojo_unittest.cc
@@ -182,7 +182,7 @@
IPC::TestChannelListener::SendOneMessage(sender(), "hello from parent");
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
@@ -200,7 +200,7 @@
listener.Init(channel());
IPC::TestChannelListener::SendOneMessage(channel(), "hello from child");
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
EXPECT_TRUE(listener.is_connected_called());
EXPECT_TRUE(listener.HasSentAll());
@@ -245,7 +245,7 @@
ListenerThatQuits listener;
Connect(&listener);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
Close();
}
@@ -267,7 +267,7 @@
overly_large_data.c_str());
}
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
@@ -407,7 +407,7 @@
TestingMessagePipe pipe;
HandleSendingHelper::WritePipeThenSend(channel(), &pipe);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
EXPECT_TRUE(WaitForClientShutdown());
@@ -420,7 +420,7 @@
Connect(&listener);
listener.set_sender(channel());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
Close();
}
@@ -484,7 +484,7 @@
Connect(&listener);
listener.set_sender(channel());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
Close();
}
@@ -505,7 +505,7 @@
WriteOK(pipe.self.get());
channel()->Send(message.release());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
EXPECT_TRUE(WaitForClientShutdown());
@@ -530,7 +530,7 @@
invalid_handle);
channel()->Send(message.release());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
EXPECT_TRUE(WaitForClientShutdown());
@@ -549,7 +549,7 @@
CreateChannel(&listener);
ASSERT_TRUE(ConnectChannel());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
ASSERT_FALSE(channel()->Send(new IPC::Message()));
@@ -580,7 +580,7 @@
Connect(&listener);
listener.set_sender(channel());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
Close();
}
@@ -620,7 +620,7 @@
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE |
base::File::FLAG_READ);
HandleSendingHelper::WriteFileThenSend(channel(), file);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
@@ -634,7 +634,7 @@
Connect(&listener);
listener.set_sender(channel());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
Close();
}
@@ -676,7 +676,7 @@
TestingMessagePipe pipe;
HandleSendingHelper::WriteFileAndPipeThenSend(channel(), file, &pipe);
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
channel()->Close();
EXPECT_TRUE(WaitForClientShutdown());
@@ -690,7 +690,7 @@
Connect(&listener);
listener.set_sender(channel());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
Close();
}
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc
index 3385646b..dfcd025 100644
--- a/ipc/sync_socket_unittest.cc
+++ b/ipc/sync_socket_unittest.cc
@@ -13,6 +13,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
@@ -115,7 +116,7 @@
IPCTestBase::GetChannelName("SyncSocketServerClient"), &listener));
EXPECT_TRUE(channel->Connect());
listener.Init(channel.get());
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
return 0;
}
@@ -199,7 +200,7 @@
#endif // defined(OS_WIN)
EXPECT_TRUE(sender()->Send(msg));
// Use the current thread as the I/O thread.
- base::MessageLoop::current()->Run();
+ base::RunLoop().Run();
// Shut down.
pair[0].Close();
pair[1].Close();