summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dbus/exported_object.cc8
-rw-r--r--dbus/exported_object.h2
-rw-r--r--dbus/object_proxy.cc22
-rw-r--r--dbus/object_proxy.h4
4 files changed, 11 insertions, 25 deletions
diff --git a/dbus/exported_object.cc b/dbus/exported_object.cc
index c4ebd3b..d207024 100644
--- a/dbus/exported_object.cc
+++ b/dbus/exported_object.cc
@@ -105,13 +105,11 @@ void ExportedObject::SendSignal(Signal* signal) {
dbus_message_ref(signal_message);
const base::TimeTicks start_time = base::TimeTicks::Now();
- // Bind() won't compile if we pass signal_message. See the comment at
- // ObjectProxy::CallMethod() for details.
bus_->PostTaskToDBusThread(FROM_HERE,
base::Bind(&ExportedObject::SendSignalInternal,
this,
start_time,
- static_cast<void*>(signal_message)));
+ signal_message));
}
void ExportedObject::Unregister() {
@@ -153,9 +151,7 @@ void ExportedObject::OnExported(OnExportedCallback on_exported_callback,
}
void ExportedObject::SendSignalInternal(base::TimeTicks start_time,
- void* in_signal_message) {
- DBusMessage* signal_message =
- static_cast<DBusMessage*>(in_signal_message);
+ DBusMessage* signal_message) {
uint32 serial = 0;
bus_->Send(signal_message, &serial);
dbus_message_unref(signal_message);
diff --git a/dbus/exported_object.h b/dbus/exported_object.h
index 41e8eec..a6edb97 100644
--- a/dbus/exported_object.h
+++ b/dbus/exported_object.h
@@ -108,7 +108,7 @@ class ExportedObject : public base::RefCountedThreadSafe<ExportedObject> {
// Helper function for SendSignal().
void SendSignalInternal(base::TimeTicks start_time,
- void* signal_message);
+ DBusMessage* signal_message);
// Registers this object to the bus.
// Returns true on success, or the object is already registered.
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) {
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h
index ffd59c2..a950e94 100644
--- a/dbus/object_proxy.h
+++ b/dbus/object_proxy.h
@@ -129,7 +129,7 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
// Starts the async method call. This is a helper function to implement
// CallMethod().
void StartAsyncMethodCall(int timeout_ms,
- void* request_message,
+ DBusMessage* request_message,
ResponseCallback response_callback,
base::TimeTicks start_time);
@@ -141,7 +141,7 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
// Runs the response callback with the given response object.
void RunResponseCallback(ResponseCallback response_callback,
base::TimeTicks start_time,
- void* response_message);
+ DBusMessage* response_message);
// Redirects the function call to OnPendingCallIsComplete().
static void OnPendingCallIsCompleteThunk(DBusPendingCall* pending_call,