diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-28 02:12:00 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-28 02:12:00 +0000 |
commit | f729d15a933e28cfc000953b75535acc90c3aa5e (patch) | |
tree | 5c889fda659777b82a634fbf7320461148237d43 /ipc/ipc_channel_proxy.cc | |
parent | ef40efe920460fe783c07b16bbbcd3e891f4608a (diff) | |
download | chromium_src-f729d15a933e28cfc000953b75535acc90c3aa5e.zip chromium_src-f729d15a933e28cfc000953b75535acc90c3aa5e.tar.gz chromium_src-f729d15a933e28cfc000953b75535acc90c3aa5e.tar.bz2 |
RefCounted types should not have public destructors, ipc/ edition
BUG=123295
TEST=none
Review URL: http://codereview.chromium.org/10008108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.cc')
-rw-r--r-- | ipc/ipc_channel_proxy.cc | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index 7eed1bd..f0e9715 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -14,33 +14,10 @@ namespace IPC { -// This helper ensures the message is deleted if the task is deleted without -// having been run. -class SendCallbackHelper - : public base::RefCountedThreadSafe<SendCallbackHelper> { - public: - SendCallbackHelper(ChannelProxy::Context* context, Message* message) - : context_(context), - message_(message) { - } - - void Send() { - context_->OnSendMessage(message_.release()); - } - - private: - scoped_refptr<ChannelProxy::Context> context_; - scoped_ptr<Message> message_; - - DISALLOW_COPY_AND_ASSIGN(SendCallbackHelper); -}; - //------------------------------------------------------------------------------ ChannelProxy::MessageFilter::MessageFilter() {} -ChannelProxy::MessageFilter::~MessageFilter() {} - void ChannelProxy::MessageFilter::OnFilterAdded(Channel* channel) {} void ChannelProxy::MessageFilter::OnFilterRemoved() {} @@ -59,6 +36,8 @@ void ChannelProxy::MessageFilter::OnDestruct() const { delete this; } +ChannelProxy::MessageFilter::~MessageFilter() {} + //------------------------------------------------------------------------------ ChannelProxy::Context::Context(Channel::Listener* listener, @@ -186,13 +165,12 @@ void ChannelProxy::Context::OnChannelClosed() { } // Called on the IPC::Channel thread -void ChannelProxy::Context::OnSendMessage(Message* message) { +void ChannelProxy::Context::OnSendMessage(scoped_ptr<Message> message) { if (!channel_.get()) { - delete message; OnChannelClosed(); return; } - if (!channel_->Send(message)) + if (!channel_->Send(message.release())) OnChannelError(); } @@ -368,8 +346,8 @@ bool ChannelProxy::Send(Message* message) { context_->ipc_message_loop()->PostTask( FROM_HERE, - base::Bind(&SendCallbackHelper::Send, - new SendCallbackHelper(context_.get(), message))); + base::Bind(&ChannelProxy::Context::OnSendMessage, + context_, base::Passed(scoped_ptr<Message>(message)))); return true; } |