Call scoped_refptr<T>::get() rather than relying on implicit "operator T*"
This upates calls to bound temporary objects to also use get().
While it has the same semantic equivalence to the existing code, this generally
represents a dangerous pattern - indeed, part of the whole motivation for this
change is to make this anti-pattern very visible to authors.
This change simply updates all of the call sites, to allow the "operator T*"
to be removed and preventing new instances. The existing instances will then be
reviewed for "suspicious" changes and updated to use/pass scoped_refptr<T>
rather than T*, as appropriate.
BUG=110610
TBR=darin
Review URL: https://codereview.chromium.org/15984016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205560 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: cadac62e5c2b9f5fef59ce0326bb2cd79ffbe622
diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc
index 21507bf..b40293f 100644
--- a/ipc/ipc_channel_unittest.cc
+++ b/ipc/ipc_channel_unittest.cc
@@ -192,7 +192,7 @@
// Set up IPC channel proxy.
GenericChannelListener listener;
- CreateChannelProxy(&listener, thread.message_loop_proxy());
+ CreateChannelProxy(&listener, thread.message_loop_proxy().get());
listener.Init(sender());
ASSERT_TRUE(StartClient());
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index f71f874..bd13089 100644
--- a/ipc/ipc_sync_channel_unittest.cc
+++ b/ipc/ipc_sync_channel_unittest.cc
@@ -154,9 +154,12 @@
}
virtual SyncChannel* CreateChannel() {
- return new SyncChannel(
- channel_name_, mode_, this, ipc_thread_.message_loop_proxy(), true,
- &shutdown_event_);
+ return new SyncChannel(channel_name_,
+ mode_,
+ this,
+ ipc_thread_.message_loop_proxy().get(),
+ true,
+ &shutdown_event_);
}
base::Thread* ListenerThread() {
@@ -325,7 +328,7 @@
virtual SyncChannel* CreateChannel() OVERRIDE {
SyncChannel* channel = new SyncChannel(
- this, ipc_thread().message_loop_proxy(), shutdown_event());
+ this, ipc_thread().message_loop_proxy().get(), shutdown_event());
channel->Init(channel_name(), mode(), create_pipe_now_);
return channel;
}
@@ -346,7 +349,7 @@
virtual SyncChannel* CreateChannel() OVERRIDE {
SyncChannel* channel = new SyncChannel(
- this, ipc_thread().message_loop_proxy(), shutdown_event());
+ this, ipc_thread().message_loop_proxy().get(), shutdown_event());
channel->Init(channel_name(), mode(), create_pipe_now_);
return channel;
}
@@ -1242,9 +1245,13 @@
else
LOG(ERROR) << "Send failed to dispatch incoming message on same channel";
- non_restricted_channel_.reset(new SyncChannel(
- "non_restricted_channel", Channel::MODE_CLIENT, this,
- ipc_thread().message_loop_proxy(), true, shutdown_event()));
+ non_restricted_channel_.reset(
+ new SyncChannel("non_restricted_channel",
+ Channel::MODE_CLIENT,
+ this,
+ ipc_thread().message_loop_proxy().get(),
+ true,
+ shutdown_event()));
server_->ListenerThread()->message_loop()->PostTask(
FROM_HERE, base::Bind(&RestrictedDispatchServer::OnDoPing, server_, 2));
@@ -1630,9 +1637,13 @@
if (is_first())
event1_->Signal();
event2_->Wait();
- other_channel_.reset(new SyncChannel(
- other_channel_name_, Channel::MODE_CLIENT, this,
- ipc_thread().message_loop_proxy(), true, shutdown_event()));
+ other_channel_.reset(
+ new SyncChannel(other_channel_name_,
+ Channel::MODE_CLIENT,
+ this,
+ ipc_thread().message_loop_proxy().get(),
+ true,
+ shutdown_event()));
other_channel_->SetRestrictDispatchChannelGroup(group_);
if (!is_first()) {
event1_->Signal();
@@ -1706,9 +1717,13 @@
server_ready_(server_ready) { }
virtual void Run() OVERRIDE {
- server2_channel_.reset(new SyncChannel(
- "reentrant_reply2", Channel::MODE_CLIENT, this,
- ipc_thread().message_loop_proxy(), true, shutdown_event()));
+ server2_channel_.reset(
+ new SyncChannel("reentrant_reply2",
+ Channel::MODE_CLIENT,
+ this,
+ ipc_thread().message_loop_proxy().get(),
+ true,
+ shutdown_event()));
server_ready_->Signal();
Message* msg = new SyncChannelTestMsg_Reentrant1();
server2_channel_->Send(msg);
diff --git a/ipc/ipc_sync_message_filter.cc b/ipc/ipc_sync_message_filter.cc
index 541d685..a534c44 100644
--- a/ipc/ipc_sync_message_filter.cc
+++ b/ipc/ipc_sync_message_filter.cc
@@ -46,8 +46,8 @@
base::AutoLock auto_lock(lock_);
// Can't use this class on the main thread or else it can lead to deadlocks.
// Also by definition, can't use this on IO thread since we're blocking it.
- DCHECK(MessageLoopProxy::current() != listener_loop_.get());
- DCHECK(MessageLoopProxy::current() != io_loop_.get());
+ DCHECK(MessageLoopProxy::current().get() != listener_loop_.get());
+ DCHECK(MessageLoopProxy::current().get() != io_loop_.get());
pending_sync_messages_.insert(&pending_message);
}
diff --git a/ipc/unix_domain_socket_util_unittest.cc b/ipc/unix_domain_socket_util_unittest.cc
index 3c0469c..81d2f06 100644
--- a/ipc/unix_domain_socket_util_unittest.cc
+++ b/ipc/unix_domain_socket_util_unittest.cc
@@ -108,7 +108,7 @@
stat(socket_name_.value().c_str(), &socket_stat);
EXPECT_TRUE(S_ISSOCK(socket_stat.st_mode));
acceptor_.reset(new SocketAcceptor(server_listen_fd_,
- worker_.message_loop_proxy()));
+ worker_.message_loop_proxy().get()));
acceptor_->WaitUntilReady();
return true;
}