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

Unified Diff: ipc/ipc_channel_proxy.cc

Issue 8714003: base::Bind: Convert IPC::SendTask. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SendCallbackHelper. Created 9 years, 1 month 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 | « ipc/ipc_channel_proxy.h ('k') | 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 fb365d61ac122e9d071bbe40bcb8a642f0873e25..f542eae2b0e59403560c4709afaf96f19ff8c6bf 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;
}
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698