Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: ipc/ipc_channel_proxy.cc

Issue 3869002: Use make_scoped_refptr() instead of manual AddRef()/Release() in ipc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698