dbus::ObjectManager: Add a match rule for properties before GetManagedObjects.
There is a race condition in the way that match rules get set up for object
proxies created in response to GetManagedObjects that may cause us the miss
PropertiesChanged signals if they're received before the match rule and filter
function get added by ObjectProxy.
This patch changes this to work the "intended" way: ObjectManager now adds a
single match rule for its corresponding service name, and specifically for the
org.freedesktop.DBus.Properties.PropertiesChanged signal. Once it receives the
signal, ObjectManager dispatches the signal to the corresponding PropertySet.
BUG=407109,400768
TEST=dbus_unittests
Review URL: https://codereview.chromium.org/510863002
Cr-Commit-Position: refs/heads/master@{#293551}
diff --git a/dbus/exported_object.cc b/dbus/exported_object.cc
index 1a4fbb5..107d2e5d 100644
--- a/dbus/exported_object.cc
+++ b/dbus/exported_object.cc
@@ -15,6 +15,7 @@
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/scoped_dbus_error.h"
+#include "dbus/util.h"
namespace dbus {
@@ -23,15 +24,6 @@
// Used for success ratio histograms. 1 for success, 0 for failure.
const int kSuccessRatioHistogramMaxValue = 2;
-// Gets the absolute method name by concatenating the interface name and
-// the method name. Used for building keys for method_table_ in
-// ExportedObject.
-std::string GetAbsoluteMethodName(
- const std::string& interface_name,
- const std::string& method_name) {
- return interface_name + "." + method_name;
-}
-
} // namespace
ExportedObject::ExportedObject(Bus* bus,
@@ -53,7 +45,7 @@
// Check if the method is already exported.
const std::string absolute_method_name =
- GetAbsoluteMethodName(interface_name, method_name);
+ GetAbsoluteMemberName(interface_name, method_name);
if (method_table_.find(absolute_method_name) != method_table_.end()) {
LOG(ERROR) << absolute_method_name << " is already exported";
return false;
@@ -203,7 +195,7 @@
}
// Check if we know about the method.
- const std::string absolute_method_name = GetAbsoluteMethodName(
+ const std::string absolute_method_name = GetAbsoluteMemberName(
interface, member);
MethodTable::const_iterator iter = method_table_.find(absolute_method_name);
if (iter == method_table_.end()) {