Chromium Code Reviews| Index: dbus/bus.h |
| =================================================================== |
| --- dbus/bus.h (revision 99574) |
| +++ dbus/bus.h (working copy) |
| @@ -13,7 +13,6 @@ |
| #include "base/callback.h" |
| #include "base/memory/ref_counted.h" |
| -#include "base/memory/scoped_ptr.h" |
| #include "base/synchronization/waitable_event.h" |
| #include "base/threading/platform_thread.h" |
| #include "base/tracked_objects.h" |
| @@ -22,6 +21,7 @@ |
| namespace base { |
| class Thread; |
| +class MessageLoopProxy; |
| } |
| namespace dbus { |
| @@ -79,9 +79,9 @@ |
| // bus.GetObjectProxy(service_name, object_path); |
| // |
| // dbus::MethodCall method_call(interface_name, method_name); |
| -// dbus::Response response; |
| -// bool success = |
| -// object_proxy.CallMethodAndBlock(&method_call, timeout_ms, &response); |
| +// scoped_ptr<dbus::Response> response( |
| +// object_proxy.CallMethodAndBlock(&method_call, timeout_ms)); |
| +// bool success = !!response.get(); |
|
satorux1
2011/09/06 17:15:57
Thank you for updating this!
!! is a bit tricky.
Mike Mammarella
2011/09/06 19:11:08
Done.
|
| // |
| // Asynchronous method call: |
| // |
| @@ -154,14 +154,16 @@ |
| BusType bus_type; // SESSION by default. |
| ConnectionType connection_type; // PRIVATE by default. |
| - // If the thread is set, the bus object will use the message loop |
| - // attached to the thread to process asynchronous operations. |
| + // If dbus_thread is set, the bus object will use that message loop to |
| + // process asynchronous operations. While the type of dbus_thread is |
| + // MessageLoopProxy, this is only for convenience so it can be set with |
| + // BrowserThread::GetMessageLoopProxyForThread(). |
|
satorux1
2011/09/06 17:15:57
I like the idea of using MessageLoopProxy.
The na
Mike Mammarella
2011/09/06 19:11:08
Done.
|
| // |
| // The thread should meet the following requirements: |
| // 1) Already running. |
| // 2) Has a MessageLoopForIO. |
| // 3) Outlives the bus. |
|
satorux1
2011/09/06 17:15:57
3) may be now irrelevant, as MessageLoopProxy take
Mike Mammarella
2011/09/06 19:11:08
Done.
|
| - base::Thread* dbus_thread; // NULL by default. |
| + scoped_refptr<base::MessageLoopProxy> dbus_thread; // NULL by default. |
| }; |
| // Creates a Bus object. The actual connection will be established when |
| @@ -430,13 +432,12 @@ |
| void* data); |
| const BusType bus_type_; |
| const ConnectionType connection_type_; |
| - base::Thread* dbus_thread_; |
| + scoped_refptr<base::MessageLoopProxy> dbus_thread_; |
| base::WaitableEvent on_shutdown_; |
| DBusConnection* connection_; |
| MessageLoop* origin_loop_; |
| base::PlatformThreadId origin_thread_id_; |
| - base::PlatformThreadId dbus_thread_id_; |
| std::set<std::string> owned_service_names_; |
| // The following sets are used to check if rules/object_paths/filters |