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

Unified Diff: dbus/bus.cc

Issue 12224139: Supporting callback for Disconnected signal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 7 years, 10 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
Index: dbus/bus.cc
diff --git a/dbus/bus.cc b/dbus/bus.cc
index 6bd404c96622bc67c0ddbd0254f33cfa86694fa2..bef20813f715e922174305915303e796509cda6c 100644
--- a/dbus/bus.cc
+++ b/dbus/bus.cc
@@ -211,6 +211,10 @@ Bus::~Bus() {
// DCHECK_EQ(0, num_pending_timeouts_);
}
+void Bus::SetDisconnectedCallback(const base::Closure& closure) {
+ on_disconnected_closure_ = closure;
+}
+
ObjectProxy* Bus::GetObjectProxy(const std::string& service_name,
const ObjectPath& object_path) {
return GetObjectProxyWithOptions(service_name, object_path,
@@ -373,6 +377,14 @@ bool Bus::Connect() {
return true;
}
+void Bus::CloseConnection() {
+ // dbus_connection_close is blocking call.
+ AssertOnDBusThread();
+
+ if (connection_type_ == PRIVATE)
+ dbus_connection_close(connection_);
+}
+
void Bus::ShutdownAndBlock() {
AssertOnDBusThread();
@@ -875,6 +887,9 @@ void Bus::OnConnectionDisconnected(DBusConnection* connection) {
return;
DCHECK(!dbus_connection_get_is_connected(connection));
+ if (!on_disconnected_closure_.is_null())
+ PostTaskToOriginThread(FROM_HERE, on_disconnected_closure_);
+
if (shutdown_completed_)
return; // Do nothing if the shutdown is already completed.
« dbus/bus.h ('K') | « dbus/bus.h ('k') | dbus/end_to_end_async_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698