diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-30 20:55:03 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-30 20:55:03 +0000 |
commit | fd0a773a19c92b94a59b9207f4cc9b154f54a144 (patch) | |
tree | d10fc47c74d613100cbd4408137194a55573dd6d | |
parent | fb4d0a34d327edf6f7abc03eec53e87243396cf0 (diff) | |
download | chromium_src-fd0a773a19c92b94a59b9207f4cc9b154f54a144.zip chromium_src-fd0a773a19c92b94a59b9207f4cc9b154f54a144.tar.gz chromium_src-fd0a773a19c92b94a59b9207f4cc9b154f54a144.tar.bz2 |
ipc: Use base::MessageLoop.
BUG=236029
R=agl@chromium.org
Review URL: https://chromiumcodereview.appspot.com/14383024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197465 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ipc/ipc_channel_factory.cc | 4 | ||||
-rw-r--r-- | ipc/ipc_channel_factory.h | 5 | ||||
-rw-r--r-- | ipc/ipc_channel_posix.cc | 15 | ||||
-rw-r--r-- | ipc/ipc_channel_posix.h | 9 | ||||
-rw-r--r-- | ipc/ipc_channel_posix_unittest.cc | 19 | ||||
-rw-r--r-- | ipc/ipc_channel_unittest.cc | 18 | ||||
-rw-r--r-- | ipc/ipc_channel_win.cc | 24 | ||||
-rw-r--r-- | ipc/ipc_channel_win.h | 12 | ||||
-rw-r--r-- | ipc/ipc_fuzzing_tests.cc | 10 | ||||
-rw-r--r-- | ipc/ipc_logging.cc | 9 | ||||
-rw-r--r-- | ipc/ipc_logging.h | 2 | ||||
-rw-r--r-- | ipc/ipc_perftests.cc | 10 | ||||
-rw-r--r-- | ipc/ipc_send_fds_test.cc | 10 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.cc | 7 | ||||
-rw-r--r-- | ipc/ipc_sync_channel_unittest.cc | 18 | ||||
-rw-r--r-- | ipc/ipc_test_base.cc | 2 | ||||
-rw-r--r-- | ipc/sync_socket_unittest.cc | 10 | ||||
-rw-r--r-- | ipc/unix_domain_socket_util_unittest.cc | 18 |
18 files changed, 101 insertions, 101 deletions
diff --git a/ipc/ipc_channel_factory.cc b/ipc/ipc_channel_factory.cc index 3d5c866..f3ad11a 100644 --- a/ipc/ipc_channel_factory.cc +++ b/ipc/ipc_channel_factory.cc @@ -33,10 +33,10 @@ bool ChannelFactory::Listen() { // Watch the fd for connections, and turn any connections into // active sockets. - MessageLoopForIO::current()->WatchFileDescriptor( + base::MessageLoopForIO::current()->WatchFileDescriptor( listen_fd_, true, - MessageLoopForIO::WATCH_READ, + base::MessageLoopForIO::WATCH_READ, &server_listen_connection_watcher_, this); return true; diff --git a/ipc/ipc_channel_factory.h b/ipc/ipc_channel_factory.h index a1e1d85..370808f 100644 --- a/ipc/ipc_channel_factory.h +++ b/ipc/ipc_channel_factory.h @@ -16,7 +16,7 @@ namespace IPC { // the socket, it accept()s the connection and passes the new FD to the // delegate. The delegate is then responsible for creating a new IPC::Channel // for the FD. -class IPC_EXPORT ChannelFactory : public MessageLoopForIO::Watcher { +class IPC_EXPORT ChannelFactory : public base::MessageLoopForIO::Watcher { public: class Delegate { public: @@ -44,7 +44,8 @@ class IPC_EXPORT ChannelFactory : public MessageLoopForIO::Watcher { virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; - MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher + server_listen_connection_watcher_; base::FilePath path_; Delegate* delegate_; int listen_fd_; diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc index 7f38a48..a945c67 100644 --- a/ipc/ipc_channel_posix.cc +++ b/ipc/ipc_channel_posix.cc @@ -335,10 +335,10 @@ bool Channel::ChannelImpl::Connect() { if (server_listen_pipe_ != -1) { // Watch the pipe for connections, and turn any connections into // active sockets. - MessageLoopForIO::current()->WatchFileDescriptor( + base::MessageLoopForIO::current()->WatchFileDescriptor( server_listen_pipe_, true, - MessageLoopForIO::WATCH_READ, + base::MessageLoopForIO::WATCH_READ, &server_listen_connection_watcher_, this); } else { @@ -469,10 +469,10 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() { // Tell libevent to call us back once things are unblocked. is_blocked_on_write_ = true; - MessageLoopForIO::current()->WatchFileDescriptor( + base::MessageLoopForIO::current()->WatchFileDescriptor( pipe_, false, // One shot - MessageLoopForIO::WATCH_WRITE, + base::MessageLoopForIO::WATCH_WRITE, &write_watcher_, this); return true; @@ -667,11 +667,8 @@ void Channel::ChannelImpl::OnFileCanWriteWithoutBlocking(int fd) { } bool Channel::ChannelImpl::AcceptConnection() { - MessageLoopForIO::current()->WatchFileDescriptor(pipe_, - true, - MessageLoopForIO::WATCH_READ, - &read_watcher_, - this); + base::MessageLoopForIO::current()->WatchFileDescriptor( + pipe_, true, base::MessageLoopForIO::WATCH_READ, &read_watcher_, this); QueueHelloMessage(); if (mode_ & MODE_CLIENT_FLAG) { diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h index 6378c33..aaefe15 100644 --- a/ipc/ipc_channel_posix.h +++ b/ipc/ipc_channel_posix.h @@ -49,7 +49,7 @@ namespace IPC { class Channel::ChannelImpl : public internal::ChannelReader, - public MessageLoopForIO::Watcher { + public base::MessageLoopForIO::Watcher { public: // Mirror methods of Channel, see ipc_channel.h for description. ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, @@ -118,9 +118,10 @@ class Channel::ChannelImpl : public internal::ChannelReader, // After accepting one client connection on our server socket we want to // stop listening. - MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_; - MessageLoopForIO::FileDescriptorWatcher read_watcher_; - MessageLoopForIO::FileDescriptorWatcher write_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher + server_listen_connection_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher read_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher write_watcher_; // Indicates whether we're currently blocked waiting for a write to complete. bool is_blocked_on_write_; diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc index b49b096..68cb377 100644 --- a/ipc/ipc_channel_posix_unittest.cc +++ b/ipc/ipc_channel_posix_unittest.cc @@ -82,7 +82,7 @@ class IPCChannelPosixTestListener : public IPC::Listener { STATUS status() { return status_; } void QuitRunLoop() { - MessageLoopForIO::current()->QuitNow(); + base::MessageLoopForIO::current()->QuitNow(); } private: @@ -105,8 +105,8 @@ class IPCChannelPosixTest : public base::MultiProcessTest { virtual void SetUp(); virtual void TearDown(); -private: - scoped_ptr<MessageLoopForIO> message_loop_; + private: + scoped_ptr<base::MessageLoopForIO> message_loop_; }; const std::string IPCChannelPosixTest::GetChannelDirName() { @@ -126,7 +126,7 @@ const std::string IPCChannelPosixTest::GetConnectionSocketName() { void IPCChannelPosixTest::SetUp() { MultiProcessTest::SetUp(); // Construct a fresh IO Message loop for the duration of each test. - message_loop_.reset(new MessageLoopForIO()); + message_loop_.reset(new base::MessageLoopForIO()); } void IPCChannelPosixTest::TearDown() { @@ -180,15 +180,12 @@ void IPCChannelPosixTest::SetUpSocket(IPC::ChannelHandle *handle, } void IPCChannelPosixTest::SpinRunLoop(base::TimeDelta delay) { - MessageLoopForIO *loop = MessageLoopForIO::current(); + base::MessageLoopForIO* loop = base::MessageLoopForIO::current(); // Post a quit task so that this loop eventually ends and we don't hang // in the case of a bad test. Usually, the run loop will quit sooner than // that because all tests use a IPCChannelPosixTestListener which quits the // current run loop on any channel activity. - loop->PostDelayedTask( - FROM_HERE, - MessageLoop::QuitClosure(), - delay); + loop->PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), delay); loop->Run(); } @@ -391,7 +388,7 @@ TEST_F(IPCChannelPosixTest, IsNamedServerInitialized) { // A long running process that connects to us MULTIPROCESS_TEST_MAIN(IPCChannelPosixTestConnectionProc) { - MessageLoopForIO message_loop; + base::MessageLoopForIO message_loop; IPCChannelPosixTestListener listener(true); IPC::ChannelHandle handle(IPCChannelPosixTest::GetConnectionSocketName()); IPCChannelPosixTest::SetUpSocket(&handle, IPC::Channel::MODE_NAMED_CLIENT); @@ -404,7 +401,7 @@ MULTIPROCESS_TEST_MAIN(IPCChannelPosixTestConnectionProc) { // Simple external process that shouldn't be able to connect to us. MULTIPROCESS_TEST_MAIN(IPCChannelPosixFailConnectionProc) { - MessageLoopForIO message_loop; + base::MessageLoopForIO message_loop; IPCChannelPosixTestListener listener(false); IPC::ChannelHandle handle(IPCChannelPosixTest::GetConnectionSocketName()); IPCChannelPosixTest::SetUpSocket(&handle, IPC::Channel::MODE_NAMED_CLIENT); diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc index db9dd3c..21507bf 100644 --- a/ipc/ipc_channel_unittest.cc +++ b/ipc/ipc_channel_unittest.cc @@ -65,7 +65,7 @@ class GenericChannelListener : public IPC::Listener { virtual void OnChannelError() OVERRIDE { // There is a race when closing the channel so the last message may be lost. EXPECT_LE(messages_left_, 1); - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } void Init(IPC::Sender* s) { @@ -75,7 +75,7 @@ class GenericChannelListener : public IPC::Listener { protected: void SendNextMessage() { if (--messages_left_ <= 0) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); else Send(sender_, "Foo"); } @@ -133,7 +133,7 @@ TEST_F(IPCChannelTest, ChannelTest) { Send(sender(), "hello from parent"); // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Close the channel so the client's OnChannelError() gets fired. channel()->Close(); @@ -172,7 +172,7 @@ TEST_F(IPCChannelTest, ChannelTestExistingPipe) { Send(sender(), "hello from parent"); // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Close the channel so the client's OnChannelError() gets fired. channel()->Close(); @@ -187,7 +187,7 @@ TEST_F(IPCChannelTest, ChannelProxyTest) { base::Thread thread("ChannelProxyTestServer"); base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; thread.StartWithOptions(options); // Set up IPC channel proxy. @@ -200,7 +200,7 @@ TEST_F(IPCChannelTest, ChannelProxyTest) { Send(sender(), "hello from parent"); // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(WaitForClientShutdown()); @@ -240,7 +240,7 @@ TEST_F(IPCChannelTest, MAYBE_SendMessageInChannelConnected) { Send(sender(), "hello from parent"); // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Close the channel so the client's OnChannelError() gets fired. channel()->Close(); @@ -250,7 +250,7 @@ TEST_F(IPCChannelTest, MAYBE_SendMessageInChannelConnected) { } MULTIPROCESS_IPC_TEST_CLIENT_MAIN(GenericClient) { - MessageLoopForIO main_message_loop; + base::MessageLoopForIO main_message_loop; GenericChannelListener listener; // Set up IPC channel. @@ -261,7 +261,7 @@ MULTIPROCESS_IPC_TEST_CLIENT_MAIN(GenericClient) { listener.Init(&channel); Send(&channel, "hello from child"); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); return 0; } diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 5ae75c84..bde64124 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -70,7 +70,7 @@ void Channel::ChannelImpl::Close() { // Make sure all IO has completed. base::Time start = base::Time::Now(); while (input_state_.is_pending || output_state_.is_pending) { - MessageLoopForIO::current()->WaitForIOCompletion(INFINITE, this); + base::MessageLoopForIO::current()->WaitForIOCompletion(INFINITE, this); } while (!output_queue_.empty()) { @@ -294,7 +294,7 @@ bool Channel::ChannelImpl::Connect() { if (pipe_ == INVALID_HANDLE_VALUE) return false; - MessageLoopForIO::current()->RegisterIOHandler(pipe_, this); + base::MessageLoopForIO::current()->RegisterIOHandler(pipe_, this); // Check to see if there is a client connected to our pipe... if (waiting_connect_) @@ -304,10 +304,13 @@ bool Channel::ChannelImpl::Connect() { // Complete setup asynchronously. By not setting input_state_.is_pending // to true, we indicate to OnIOCompleted that this is the special // initialization signal. - MessageLoopForIO::current()->PostTask( - FROM_HERE, base::Bind(&Channel::ChannelImpl::OnIOCompleted, - weak_factory_.GetWeakPtr(), &input_state_.context, - 0, 0)); + base::MessageLoopForIO::current()->PostTask( + FROM_HERE, + base::Bind(&Channel::ChannelImpl::OnIOCompleted, + weak_factory_.GetWeakPtr(), + &input_state_.context, + 0, + 0)); } if (!waiting_connect_) @@ -353,7 +356,7 @@ bool Channel::ChannelImpl::ProcessConnection() { } bool Channel::ChannelImpl::ProcessOutgoingMessages( - MessageLoopForIO::IOContext* context, + base::MessageLoopForIO::IOContext* context, DWORD bytes_written) { DCHECK(!waiting_connect_); // Why are we trying to send messages if there's // no connection? @@ -409,9 +412,10 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages( return true; } -void Channel::ChannelImpl::OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, - DWORD error) { +void Channel::ChannelImpl::OnIOCompleted( + base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error) { bool ok = true; DCHECK(thread_check_->CalledOnValidThread()); if (context == &input_state_.context) { diff --git a/ipc/ipc_channel_win.h b/ipc/ipc_channel_win.h index bffae54..4b93bb6 100644 --- a/ipc/ipc_channel_win.h +++ b/ipc/ipc_channel_win.h @@ -22,7 +22,7 @@ class ThreadChecker; namespace IPC { class Channel::ChannelImpl : public internal::ChannelReader, - public MessageLoopForIO::IOHandler { + public base::MessageLoopForIO::IOHandler { public: // Mirror methods of Channel, see ipc_channel.h for description. ChannelImpl(const IPC::ChannelHandle &channel_handle, Mode mode, @@ -48,17 +48,19 @@ class Channel::ChannelImpl : public internal::ChannelReader, bool CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode); bool ProcessConnection(); - bool ProcessOutgoingMessages(MessageLoopForIO::IOContext* context, + bool ProcessOutgoingMessages(base::MessageLoopForIO::IOContext* context, DWORD bytes_written); // MessageLoop::IOHandler implementation. - virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, DWORD error); + virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error); + private: struct State { explicit State(ChannelImpl* channel); ~State(); - MessageLoopForIO::IOContext context; + base::MessageLoopForIO::IOContext context; bool is_pending; }; diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc index 1b06b7e2..c4c8019 100644 --- a/ipc/ipc_fuzzing_tests.cc +++ b/ipc/ipc_fuzzing_tests.cc @@ -175,7 +175,7 @@ class FuzzerServerListener : public SimpleListener { --message_count_; --pending_messages_; if (0 == message_count_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } void ReplyMsgNotHandled(uint32 type_id) { @@ -201,7 +201,7 @@ class FuzzerClientListener : public SimpleListener { virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE { last_msg_ = new IPC::Message(msg); - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); return true; } @@ -231,7 +231,7 @@ class FuzzerClientListener : public SimpleListener { private: bool MsgHandlerInternal(uint32 type_id) { - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); if (NULL == last_msg_) return false; if (FUZZER_ROUTING_ID != last_msg_->routing_id()) @@ -245,14 +245,14 @@ class FuzzerClientListener : public SimpleListener { // Runs the fuzzing server child mode. Returns when the preset number of // messages have been received. MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) { - MessageLoopForIO main_message_loop; + base::MessageLoopForIO main_message_loop; FuzzerServerListener listener; IPC::Channel channel(IPCTestBase::GetChannelName("FuzzServerClient"), IPC::Channel::MODE_CLIENT, &listener); CHECK(channel.Connect()); listener.Init(&channel); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); return 0; } diff --git a/ipc/ipc_logging.cc b/ipc/ipc_logging.cc index 0691a9a..7c7c961 100644 --- a/ipc/ipc_logging.cc +++ b/ipc/ipc_logging.cc @@ -46,7 +46,7 @@ Logging::Logging() enabled_color_(false), queue_invoke_later_pending_(false), sender_(NULL), - main_thread_(MessageLoop::current()), + main_thread_(base::MessageLoop::current()), consumer_(NULL) { #if defined(OS_WIN) // getenv triggers an unsafe warning. Simply check how big of a buffer @@ -159,7 +159,7 @@ void Logging::OnPostDispatchMessage(const Message& message, LogData data; GenerateLogData(channel_id, message, &data, true); - if (MessageLoop::current() == main_thread_) { + if (base::MessageLoop::current() == main_thread_) { Log(data); } else { main_thread_->PostTask( @@ -232,8 +232,9 @@ void Logging::Log(const LogData& data) { queued_logs_.push_back(data); if (!queue_invoke_later_pending_) { queue_invoke_later_pending_ = true; - MessageLoop::current()->PostDelayedTask( - FROM_HERE, base::Bind(&Logging::OnSendLogs, base::Unretained(this)), + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&Logging::OnSendLogs, base::Unretained(this)), base::TimeDelta::FromMilliseconds(kLogSendDelayMs)); } } diff --git a/ipc/ipc_logging.h b/ipc/ipc_logging.h index 482c06d..dd3652c 100644 --- a/ipc/ipc_logging.h +++ b/ipc/ipc_logging.h @@ -113,7 +113,7 @@ class IPC_EXPORT Logging { bool queue_invoke_later_pending_; Sender* sender_; - MessageLoop* main_thread_; + base::MessageLoop* main_thread_; Consumer* consumer_; diff --git a/ipc/ipc_perftests.cc b/ipc/ipc_perftests.cc index cc222be..bd65c47 100644 --- a/ipc/ipc_perftests.cc +++ b/ipc/ipc_perftests.cc @@ -114,7 +114,7 @@ class ChannelReflectorListener : public IPC::Listener { latency_tracker_.Reset(); } else if (payload == "quit") { latency_tracker_.ShowResults(); - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); return true; } else { // Don't track hello and quit messages. @@ -196,7 +196,7 @@ class PerformanceChannelListener : public IPC::Listener { if (count_down_ == 0) { perf_logger_.reset(); // Stop the perf timer now. latency_tracker_.ShowResults(); - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); return true; } } @@ -246,7 +246,7 @@ TEST_F(IPCChannelPerfTest, Performance) { sender()->Send(message); // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); msg_size *= kMsgSizeBase; } @@ -264,7 +264,7 @@ TEST_F(IPCChannelPerfTest, Performance) { // This message loop bounces all messages back to the sender. MULTIPROCESS_IPC_TEST_CLIENT_MAIN(PerformanceClient) { - MessageLoopForIO main_message_loop; + base::MessageLoopForIO main_message_loop; ChannelReflectorListener listener; IPC::Channel channel(IPCTestBase::GetChannelName("PerformanceClient"), IPC::Channel::MODE_CLIENT, @@ -272,7 +272,7 @@ MULTIPROCESS_IPC_TEST_CLIENT_MAIN(PerformanceClient) { listener.Init(&channel); CHECK(channel.Connect()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); return 0; } diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index 75d1629..f611e2e 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc @@ -59,13 +59,13 @@ class MyChannelDescriptorListener : public IPC::Listener { VerifyAndCloseDescriptor(descriptor.fd, expected_inode_num_); if (num_fds_received_ == kNumFDsToSend) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); return true; } virtual void OnChannelError() OVERRIDE { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } bool GotExpectedNumberOfDescriptors() const { @@ -98,7 +98,7 @@ class IPCSendFdsTest : public IPCTestBase { } // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Close the channel so the client's OnChannelError() gets fired. channel()->Close(); @@ -115,7 +115,7 @@ TEST_F(IPCSendFdsTest, DescriptorTest) { int SendFdsClientCommon(const std::string& test_client_name, ino_t expected_inode_num) { - MessageLoopForIO main_message_loop; + base::MessageLoopForIO main_message_loop; MyChannelDescriptorListener listener(expected_inode_num); // Set up IPC channel. @@ -125,7 +125,7 @@ int SendFdsClientCommon(const std::string& test_client_name, CHECK(channel.Connect()); // Run message loop. - MessageLoop::current()->Run(); + base::MessageLoop::current()->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.cc b/ipc/ipc_sync_channel.cc index 1ce9f6c..50d48ea 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -395,7 +395,7 @@ void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) { } else { // We got the reply, timed out or the process shutdown. DCHECK_EQ(GetSendDoneEvent(), event); - MessageLoop::current()->QuitNow(); + base::MessageLoop::current()->QuitNow(); } } @@ -542,8 +542,9 @@ void SyncChannel::WaitForReplyWithNestedMessageLoop(SyncContext* context) { context->MakeWaitableEventCallback()); { - MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); - MessageLoop::current()->Run(); + base::MessageLoop::ScopedNestableTaskAllower allow( + base::MessageLoop::current()); + base::MessageLoop::current()->Run(); } sync_msg_queue->set_top_send_done_watcher(old_send_done_event_watcher); diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index 203d108..4fcb073 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -70,11 +70,11 @@ class Worker : public Listener, public Sender { } void WaitForChannelCreation() { channel_created_->Wait(); } void CloseChannel() { - DCHECK(MessageLoop::current() == ListenerThread()->message_loop()); + DCHECK(base::MessageLoop::current() == ListenerThread()->message_loop()); channel_->Close(); } void Start() { - StartThread(&listener_thread_, MessageLoop::TYPE_DEFAULT); + StartThread(&listener_thread_, base::MessageLoop::TYPE_DEFAULT); ListenerThread()->message_loop()->PostTask( FROM_HERE, base::Bind(&Worker::OnStart, this)); } @@ -169,7 +169,7 @@ class Worker : public Listener, public Sender { // Called on the listener thread to create the sync channel. void OnStart() { // Link ipc_thread_, listener_thread_ and channel_ altogether. - StartThread(&ipc_thread_, MessageLoop::TYPE_IO); + StartThread(&ipc_thread_, base::MessageLoop::TYPE_IO); channel_.reset(CreateChannel()); channel_created_->Signal(); Run(); @@ -213,7 +213,7 @@ class Worker : public Listener, public Sender { return true; } - void StartThread(base::Thread* thread, MessageLoop::Type type) { + void StartThread(base::Thread* thread, base::MessageLoop::Type type) { base::Thread::Options options; options.message_loop_type = type; thread->StartWithOptions(options); @@ -266,7 +266,7 @@ void RunTest(std::vector<Worker*> workers) { class IPCSyncChannelTest : public testing::Test { private: - MessageLoop message_loop_; + base::MessageLoop message_loop_; }; //------------------------------------------------------------------------------ @@ -1001,9 +1001,9 @@ class DoneEventRaceServer : public Worker { : Worker(Channel::MODE_SERVER, "done_event_race_server") { } virtual void Run() OVERRIDE { - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&NestedCallback, this)); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostTask(FROM_HERE, + base::Bind(&NestedCallback, this)); + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&TimeoutCallback), base::TimeDelta::FromSeconds(9)); @@ -1068,7 +1068,7 @@ class SyncMessageFilterServer : public Worker { : Worker(Channel::MODE_SERVER, "sync_message_filter_server"), thread_("helper_thread") { base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_DEFAULT; + options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; thread_.StartWithOptions(options); filter_ = new TestSyncMessageFilter(shutdown_event(), this, thread_.message_loop_proxy()); diff --git a/ipc/ipc_test_base.cc b/ipc/ipc_test_base.cc index 2f739f1..ddf2ef2 100644 --- a/ipc/ipc_test_base.cc +++ b/ipc/ipc_test_base.cc @@ -31,7 +31,7 @@ void IPCTestBase::SetUp() { // Construct a fresh IO Message loop for the duration of each test. DCHECK(!message_loop_.get()); - message_loop_.reset(new MessageLoopForIO()); + message_loop_.reset(new base::MessageLoopForIO()); } void IPCTestBase::TearDown() { diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index 5555abb..d9feac6 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc @@ -96,7 +96,7 @@ class SyncSocketServerListener : public IPC::Listener { // When the client responds, it sends back a shutdown message, // which causes the message loop to exit. void OnMsgClassShutdown() { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } IPC::Channel* chan_; @@ -107,14 +107,14 @@ class SyncSocketServerListener : public IPC::Listener { // Runs the fuzzing server child mode. Returns when the preset number of // messages have been received. MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SyncSocketServerClient) { - MessageLoopForIO main_message_loop; + base::MessageLoopForIO main_message_loop; SyncSocketServerListener listener; IPC::Channel channel(IPCTestBase::GetChannelName("SyncSocketServerClient"), IPC::Channel::MODE_CLIENT, &listener); EXPECT_TRUE(channel.Connect()); listener.Init(&channel); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); return 0; } @@ -154,7 +154,7 @@ class SyncSocketClientListener : public IPC::Listener { EXPECT_EQ(0U, socket_->Peek()); IPC::Message* msg = new MsgClassShutdown(); EXPECT_TRUE(chan_->Send(msg)); - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } base::SyncSocket* socket_; @@ -198,7 +198,7 @@ TEST_F(SyncSocketTest, SanityTest) { #endif // defined(OS_WIN) EXPECT_TRUE(sender()->Send(msg)); // Use the current thread as the I/O thread. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Shut down. pair[0].Close(); pair[1].Close(); diff --git a/ipc/unix_domain_socket_util_unittest.cc b/ipc/unix_domain_socket_util_unittest.cc index a00d3aa..13a6f8f 100644 --- a/ipc/unix_domain_socket_util_unittest.cc +++ b/ipc/unix_domain_socket_util_unittest.cc @@ -16,7 +16,7 @@ namespace { -class SocketAcceptor : public MessageLoopForIO::Watcher { +class SocketAcceptor : public base::MessageLoopForIO::Watcher { public: SocketAcceptor(int fd, base::MessageLoopProxy* target_thread) : server_fd_(-1), @@ -51,16 +51,12 @@ class SocketAcceptor : public MessageLoopForIO::Watcher { private: void StartWatching(int fd) { - watcher_.reset(new MessageLoopForIO::FileDescriptorWatcher); - MessageLoopForIO::current()->WatchFileDescriptor( - fd, - true, - MessageLoopForIO::WATCH_READ, - watcher_.get(), - this); + watcher_.reset(new base::MessageLoopForIO::FileDescriptorWatcher); + base::MessageLoopForIO::current()->WatchFileDescriptor( + fd, true, base::MessageLoopForIO::WATCH_READ, watcher_.get(), this); started_watching_event_.Signal(); } - void StopWatching(MessageLoopForIO::FileDescriptorWatcher* watcher) { + void StopWatching(base::MessageLoopForIO::FileDescriptorWatcher* watcher) { watcher->StopWatchingFileDescriptor(); delete watcher; } @@ -74,7 +70,7 @@ class SocketAcceptor : public MessageLoopForIO::Watcher { int server_fd_; base::MessageLoopProxy* target_thread_; - scoped_ptr<MessageLoopForIO::FileDescriptorWatcher> watcher_; + scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> watcher_; base::WaitableEvent started_watching_event_; base::WaitableEvent accepted_event_; @@ -100,7 +96,7 @@ class TestUnixSocketConnection { client_fd_(-1) { socket_name_ = GetChannelDir().Append("TestSocket"); base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; worker_.StartWithOptions(options); } |