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

Unified Diff: dbus/bus.cc

Issue 12224139: Supporting callback for Disconnected signal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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..e4e91d7b1310d588a513a26a5e6c146d33bde211 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 OnDisconnectedCallback& callback) {
+ on_disconnected_callback_ = callback;
+}
+
ObjectProxy* Bus::GetObjectProxy(const std::string& service_name,
const ObjectPath& object_path) {
return GetObjectProxyWithOptions(service_name, object_path,
@@ -875,6 +879,9 @@ void Bus::OnConnectionDisconnected(DBusConnection* connection) {
return;
DCHECK(!dbus_connection_get_is_connected(connection));
+ if (!on_disconnected_callback_.is_null())
+ PostTaskToOriginThread(FROM_HERE, on_disconnected_callback_);
+
if (shutdown_completed_)
return; // Do nothing if the shutdown is already completed.

Powered by Google App Engine
This is Rietveld 408576698