summaryrefslogtreecommitdiffstats
path: root/dbus/exported_object.h
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-09 04:39:17 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-09 04:39:17 +0000
commit332577dd8956454ca7c13d6488504c08894ef109 (patch)
treea3f034e798bb84841523f9aa05b839c1182dce41 /dbus/exported_object.h
parentca49fa84ef9d8679d6b9507337bfcdcb072a8fe3 (diff)
downloadchromium_src-332577dd8956454ca7c13d6488504c08894ef109.zip
chromium_src-332577dd8956454ca7c13d6488504c08894ef109.tar.gz
chromium_src-332577dd8956454ca7c13d6488504c08894ef109.tar.bz2
dbus: Add comments about the right way to expose methods
Along the way, fix the order in the test service used in unit tests. BUG=332120 TEST=dbus_unittests pass as before Review URL: https://codereview.chromium.org/125673003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/exported_object.h')
-rw-r--r--dbus/exported_object.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/dbus/exported_object.h b/dbus/exported_object.h
index eae2767..5f74dc2 100644
--- a/dbus/exported_object.h
+++ b/dbus/exported_object.h
@@ -66,6 +66,14 @@ class CHROME_DBUS_EXPORT ExportedObject
// |method_callback| can safely reference objects in the origin thread
// (i.e. UI thread in most cases).
//
+ // IMPORTANT NOTE: You should export all methods before requesting a
+ // service name by Bus::RequestOwnership/AndBlock(). If you do it in the
+ // wrong order (i.e. request a service name then export methods), there
+ // will be a short time period where your service is unable to respond to
+ // method calls because these methods aren't yet exposed. This race is a
+ // real problem as clients may start calling methods of your service as
+ // soon as you acquire a service name, by watching the name owner change.
+ //
// BLOCKING CALL.
virtual bool ExportMethodAndBlock(const std::string& interface_name,
const std::string& method_name,