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

Unified Diff: dbus/bus.h

Issue 7800023: Linux: use MessageLoopProxy instead of base::Thread in our DBus client library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months 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 | « no previous file | dbus/bus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/bus.h
===================================================================
--- dbus/bus.h (revision 99666)
+++ 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 {
@@ -35,15 +35,15 @@
// For asynchronous operations such as an asynchronous method call, the
// bus object will use a message loop to monitor the underlying file
// descriptor used for D-Bus communication. By default, the bus will use
-// the current thread's MessageLoopForIO. If |dbus_thread| option is
-// specified, the bus will use the D-Bus thread's message loop.
+// the current thread's MessageLoopForIO. If |dbus_thread_message_loop_proxy|
+// option is specified, the bus will use that message loop instead.
//
// THREADING
//
// In the D-Bus library, we use the two threads:
//
// - The origin thread: the thread that created the Bus object.
-// - The D-Bus thread: the thread supplied by |dbus_thread| option.
+// - The D-Bus thread: the thread servicing |dbus_thread_message_loop_proxy|.
//
// The origin thread is usually Chrome's UI thread. The D-Bus thread is
// usually a dedicated thread for the D-Bus library.
@@ -79,9 +79,11 @@
// 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));
+// if (response.get() != NULL) { // Success.
+// ...
+// }
//
// Asynchronous method call:
//
@@ -154,14 +156,14 @@
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_message_loop_proxy is set, the bus object will use that
+ // message loop to process asynchronous operations.
//
- // The thread should meet the following requirements:
+ // The thread servicing the message loop proxy should meet the following
+ // requirements:
// 1) Already running.
// 2) Has a MessageLoopForIO.
- // 3) Outlives the bus.
- base::Thread* dbus_thread; // NULL by default.
+ scoped_refptr<base::MessageLoopProxy> dbus_thread_message_loop_proxy;
};
// 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_message_loop_proxy_;
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
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698