summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_proxy.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 02:24:28 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 02:24:28 +0000
commitb53225088747643b4ef35bc4e10e2622ec63ce30 (patch)
tree9a9714078420fef884baf776882fa503c5e58103 /ipc/ipc_channel_proxy.cc
parent3f2efe60bb9d1829f6ba2f09b8752581b9b6b481 (diff)
downloadchromium_src-b53225088747643b4ef35bc4e10e2622ec63ce30.zip
chromium_src-b53225088747643b4ef35bc4e10e2622ec63ce30.tar.gz
chromium_src-b53225088747643b4ef35bc4e10e2622ec63ce30.tar.bz2
base::Bind: Convert IPC::SendTask.
BUG=none TEST=none R=groby@chromium.org Review URL: http://codereview.chromium.org/8714003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.cc')
-rw-r--r--ipc/ipc_channel_proxy.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index fb365d6..f542eae 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/bind.h"
+#include "base/compiler_specific.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -12,18 +13,17 @@
namespace IPC {
-//------------------------------------------------------------------------------
-
-// This task ensures the message is deleted if the task is deleted without
+// This helper ensures the message is deleted if the task is deleted without
// having been run.
-class SendTask : public Task {
+class SendCallbackHelper
+ : public base::RefCountedThreadSafe<SendCallbackHelper> {
public:
- SendTask(ChannelProxy::Context* context, Message* message)
+ SendCallbackHelper(ChannelProxy::Context* context, Message* message)
: context_(context),
message_(message) {
}
- virtual void Run() {
+ void Send() {
context_->OnSendMessage(message_.release());
}
@@ -31,7 +31,7 @@ class SendTask : public Task {
scoped_refptr<ChannelProxy::Context> context_;
scoped_ptr<Message> message_;
- DISALLOW_COPY_AND_ASSIGN(SendTask);
+ DISALLOW_COPY_AND_ASSIGN(SendCallbackHelper);
};
//------------------------------------------------------------------------------
@@ -354,8 +354,10 @@ bool ChannelProxy::Send(Message* message) {
Logging::GetInstance()->OnSendMessage(message, context_->channel_id());
#endif
- context_->ipc_message_loop()->PostTask(FROM_HERE,
- new SendTask(context_.get(), message));
+ context_->ipc_message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&SendCallbackHelper::Send,
+ new SendCallbackHelper(context_.get(), message)));
return true;
}