Index: ipc/ipc_channel_proxy.cc |
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc |
index 97852163076649f01c5a1fdefe6f4b8624841919..feca4eb956211f7e6b0242dc52e6b721e17cda25 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() { |