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

Unified Diff: dbus/object_proxy.cc

Issue 14333009: D-Bus: allow multiple signal handlers for a signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « dbus/object_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/object_proxy.cc
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index f6b29521301615c74ae8bdb037157be535313a14..0e56c7a7a7ba766753703cfd1a75fc494fb56961 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -495,11 +495,14 @@ DBusHandlerResult ObjectProxy::HandleMessage(
}
void ObjectProxy::RunMethod(base::TimeTicks start_time,
- SignalCallback signal_callback,
+ std::vector<SignalCallback> signal_callbacks,
Signal* signal) {
bus_->AssertOnOriginThread();
- signal_callback.Run(signal);
+ for (std::vector<SignalCallback>::iterator iter = signal_callbacks.begin();
+ iter != signal_callbacks.end(); ++iter)
+ iter->Run(signal);
+
// Delete the message on the D-Bus thread. See comments in
// RunResponseCallback().
bus_->PostTaskToDBusThread(
@@ -568,12 +571,12 @@ bool ObjectProxy::AddMatchRuleWithCallback(
// Store the match rule, so that we can remove this in Detach().
match_rules_.insert(match_rule);
// Add the signal callback to the method table.
- method_table_[absolute_signal_name] = signal_callback;
+ method_table_[absolute_signal_name].push_back(signal_callback);
return true;
}
} else {
// We already have the match rule.
- method_table_[absolute_signal_name] = signal_callback;
+ method_table_[absolute_signal_name].push_back(signal_callback);
return true;
}
}
@@ -654,11 +657,13 @@ DBusHandlerResult ObjectProxy::HandleNameOwnerChanged(
if (!name_owner_changed_callback_.is_null()) {
const base::TimeTicks start_time = base::TimeTicks::Now();
Signal* released_signal = signal.release();
+ std::vector<SignalCallback> callbacks;
+ callbacks.push_back(name_owner_changed_callback_);
bus_->PostTaskToOriginThread(FROM_HERE,
base::Bind(&ObjectProxy::RunMethod,
this,
start_time,
- name_owner_changed_callback_,
+ callbacks,
released_signal));
}
}
« no previous file with comments | « dbus/object_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698