diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 00:41:30 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 00:41:30 +0000 |
commit | 1e2917814446b821d4c326282d819ddd318ff175 (patch) | |
tree | 636cb3f1f97addf90ca31f90e9b5385fd9e3cba6 /ipc/ipc_channel_proxy.cc | |
parent | f9e3c52fb5feba4c279dbbbec049aff0b45b3955 (diff) | |
download | chromium_src-1e2917814446b821d4c326282d819ddd318ff175.zip chromium_src-1e2917814446b821d4c326282d819ddd318ff175.tar.gz chromium_src-1e2917814446b821d4c326282d819ddd318ff175.tar.bz2 |
Fix instances of passing raw pointers to RefCounted objects in tasks.
Some of these manually handled it correctly by using AddRef()/Release() pairs. I switched them to make_scoped_refptr() to be more consistent. This also makes them cleanup properly on MessageLoop shutdown if we start deleting tasks.
BUG=28083
TEST=builds
Review URL: http://codereview.chromium.org/3581008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.cc')
-rw-r--r-- | ipc/ipc_channel_proxy.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index 9785216..feca4eb 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -196,9 +196,6 @@ void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) { // so that the filter gets access to the Channel. if (channel_) filter->OnFilterAdded(channel_); - - // Balances the AddRef in ChannelProxy::AddFilter. - filter->Release(); } // Called on the IPC::Channel thread @@ -317,16 +314,20 @@ bool ChannelProxy::Send(Message* message) { } void ChannelProxy::AddFilter(MessageFilter* filter) { - // We want to addref the filter to prevent it from - // being destroyed before the OnAddFilter call is invoked. - filter->AddRef(); - context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - context_.get(), &Context::OnAddFilter, filter)); + context_->ipc_message_loop()->PostTask( + FROM_HERE, + NewRunnableMethod( + context_.get(), + &Context::OnAddFilter, + make_scoped_refptr(filter))); } void ChannelProxy::RemoveFilter(MessageFilter* filter) { - context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - context_.get(), &Context::OnRemoveFilter, filter)); + context_->ipc_message_loop()->PostTask( + FROM_HERE, NewRunnableMethod( + context_.get(), + &Context::OnRemoveFilter, + make_scoped_refptr(filter))); } void ChannelProxy::ClearIPCMessageLoop() { |