diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 23:39:17 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 23:39:17 +0000 |
commit | 3b6205cfb6b12f5e1368b6cc57e24debec56e434 (patch) | |
tree | f918f074b479de8e02dc4b758884458ff9e9f415 /dbus/object_proxy.h | |
parent | d60237b308273eb22b96b4247b1a9d12d7e99dfe (diff) | |
download | chromium_src-3b6205cfb6b12f5e1368b6cc57e24debec56e434.zip chromium_src-3b6205cfb6b12f5e1368b6cc57e24debec56e434.tar.gz chromium_src-3b6205cfb6b12f5e1368b6cc57e24debec56e434.tar.bz2 |
dbus: don't fail when reconnecting object signals
Since dbus::ObjectProxy is silently cached, with no way to invalidate,
it's possible that individual instances of objects will come and go
using the same underlying object proxy. i.e. dbus::PropertySet
These will need to change the signal callbacks to be bound to their
own instance, so the current behaviour of failing in this case with
a log message is pessimal.
Change dbus::ObjectProxy to overwrite the existing signal callbacks
with the new ones on repeated calls, rather than preserve the first.
BUG=chromium-os:28064
TEST=unit test included, and we receive property notifications on devices after connection now
Change-Id: Ic4ae092163a364c53bdfcf88f4ce8f74b110b5cb
R=satorux@chromium.org
Review URL: http://codereview.chromium.org/9808001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/object_proxy.h')
-rw-r--r-- | dbus/object_proxy.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h index 3a9fab1..6c786ab4 100644 --- a/dbus/object_proxy.h +++ b/dbus/object_proxy.h @@ -29,7 +29,9 @@ class Signal; // calling methods of these objects. // // ObjectProxy is a ref counted object, to ensure that |this| of the -// object is is alive when callbacks referencing |this| are called. +// object is is alive when callbacks referencing |this| are called; the +// bus always holds at least one of those references so object proxies +// always last as long as the bus that created them. class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> { public: // Client code should use Bus::GetObjectProxy() or @@ -96,7 +98,8 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> { int timeout_ms, ResponseCallback callback); - // Requests to connect to the signal from the remote object. + // Requests to connect to the signal from the remote object, replacing + // any previous |signal_callback| connected to that signal. // // |signal_callback| will be called in the origin thread, when the // signal is received from the remote object. As it's called in the |