diff options
author | armansito <armansito@chromium.org> | 2014-09-05 10:49:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-05 17:52:01 +0000 |
commit | ebff093d22cd5c0613f3493acdbc1af1cfd5d31f (patch) | |
tree | 39994650df189224daec3bd24aa469cf17227abd /dbus/test_service.cc | |
parent | 4502cc6303f4aabd05e7fef6fbfaf4dfd1600bb6 (diff) | |
download | chromium_src-ebff093d22cd5c0613f3493acdbc1af1cfd5d31f.zip chromium_src-ebff093d22cd5c0613f3493acdbc1af1cfd5d31f.tar.gz chromium_src-ebff093d22cd5c0613f3493acdbc1af1cfd5d31f.tar.bz2 |
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}
Diffstat (limited to 'dbus/test_service.cc')
-rw-r--r-- | dbus/test_service.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/dbus/test_service.cc b/dbus/test_service.cc index 96fa8bc..c976c37 100644 --- a/dbus/test_service.cc +++ b/dbus/test_service.cc @@ -24,7 +24,7 @@ void EmptyCallback(bool /* success */) { namespace dbus { // Echo, SlowEcho, AsyncEcho, BrokenMethod, GetAll, Get, Set, PerformAction, -// GetManagedObjects. +// GetManagedObjects const int TestService::kNumMethodsToExport = 9; TestService::Options::Options() @@ -160,6 +160,10 @@ void TestService::ReleaseOwnershipInternal( callback); } +void TestService::SetSendImmediatePropertiesChanged() { + send_immediate_properties_changed_ = true; +} + void TestService::OnExported(const std::string& interface_name, const std::string& method_name, bool success) { @@ -471,11 +475,13 @@ void TestService::PerformAction( return; } - if (action == "AddObject") + if (action == "AddObject") { AddObject(object_path); - else if (action == "RemoveObject") + } else if (action == "RemoveObject") { RemoveObject(object_path); - else if (action == "ReleaseOwnership") { + } else if (action == "SetSendImmediatePropertiesChanged") { + SetSendImmediatePropertiesChanged(); + } if (action == "ReleaseOwnership") { ReleaseOwnership(base::Bind(&TestService::PerformActionResponse, base::Unretained(this), method_call, response_sender)); @@ -556,6 +562,9 @@ void TestService::GetManagedObjects( writer.CloseContainer(&array_writer); response_sender.Run(response.Pass()); + + if (send_immediate_properties_changed_) + SendPropertyChangedSignal("ChangedTestServiceName"); } void TestService::AddPropertiesToWriter(MessageWriter* writer) { |