summaryrefslogtreecommitdiffstats
path: root/dbus/object_proxy.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 13:47:21 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 13:47:21 +0000
commit1d887b27477d3b8af67ff392d704b430fa9a4c08 (patch)
tree3c9ff0bb7b99ff849a68b5a331f8dd3671aefa13 /dbus/object_proxy.cc
parent2e99f7c101980a8958b28d990b6eb1ee385be35c (diff)
downloadchromium_src-1d887b27477d3b8af67ff392d704b430fa9a4c08.zip
chromium_src-1d887b27477d3b8af67ff392d704b430fa9a4c08.tar.gz
chromium_src-1d887b27477d3b8af67ff392d704b430fa9a4c08.tar.bz2
Eliminate hacks needed to work around a limitation of base::Bind()
base::Bind() used to be unable to handle opaque type pointers, but the limitation was fixed in crrev.com/103627. BUG=crosbug.com/21166 TEST=build and run dbus_unittests Review URL: http://codereview.chromium.org/8124002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/object_proxy.cc')
-rw-r--r--dbus/object_proxy.cc22
1 files changed, 6 insertions, 16 deletions
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 863bef5..7d24c7e 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -95,14 +95,11 @@ void ObjectProxy::CallMethod(MethodCall* method_call,
DBusMessage* request_message = method_call->raw_message();
dbus_message_ref(request_message);
- // Bind() won't compile if we pass request_message as-is since
- // DBusMessage is an opaque struct which Bind() cannot handle.
- // Hence we cast it to void* to workaround the issue.
const base::TimeTicks start_time = base::TimeTicks::Now();
base::Closure task = base::Bind(&ObjectProxy::StartAsyncMethodCall,
this,
timeout_ms,
- static_cast<void*>(request_message),
+ request_message,
callback,
start_time);
// Wait for the response in the D-Bus thread.
@@ -153,7 +150,7 @@ ObjectProxy::OnPendingCallIsCompleteData::~OnPendingCallIsCompleteData() {
}
void ObjectProxy::StartAsyncMethodCall(int timeout_ms,
- void* in_request_message,
+ DBusMessage* request_message,
ResponseCallback response_callback,
base::TimeTicks start_time) {
bus_->AssertOnDBusThread();
@@ -161,18 +158,16 @@ void ObjectProxy::StartAsyncMethodCall(int timeout_ms,
if (!bus_->Connect() || !bus_->SetUpAsyncOperations()) {
// In case of a failure, run the callback with NULL response, that
// indicates a failure.
- Response* response = NULL;
+ DBusMessage* response_message = NULL;
base::Closure task = base::Bind(&ObjectProxy::RunResponseCallback,
this,
response_callback,
start_time,
- response);
+ response_message);
bus_->PostTaskToOriginThread(FROM_HERE, task);
return;
}
- DBusMessage* request_message =
- static_cast<DBusMessage*>(in_request_message);
DBusPendingCall* pending_call = NULL;
bus_->SendWithReply(request_message, &pending_call, timeout_ms);
@@ -201,23 +196,18 @@ void ObjectProxy::OnPendingCallIsComplete(DBusPendingCall* pending_call,
bus_->AssertOnDBusThread();
DBusMessage* response_message = dbus_pending_call_steal_reply(pending_call);
- // |response_message| will be unref'ed in RunResponseCallback().
- // Bind() won't compile if we pass response_message as-is.
- // See CallMethod() for details.
base::Closure task = base::Bind(&ObjectProxy::RunResponseCallback,
this,
response_callback,
start_time,
- static_cast<void*>(response_message));
+ response_message);
bus_->PostTaskToOriginThread(FROM_HERE, task);
}
void ObjectProxy::RunResponseCallback(ResponseCallback response_callback,
base::TimeTicks start_time,
- void* in_response_message) {
+ DBusMessage* response_message) {
bus_->AssertOnOriginThread();
- DBusMessage* response_message =
- static_cast<DBusMessage*>(in_response_message);
bool response_callback_called = false;
if (!response_message) {