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

Unified Diff: dbus/exported_object.h

Issue 125673003: dbus: Add comments about the right way to expose methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/bus.h ('k') | dbus/test_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/exported_object.h
diff --git a/dbus/exported_object.h b/dbus/exported_object.h
index eae276760c592931b22f85703099b143d616622d..5f74dc2b1e4e68654079ee146299b30abc94004e 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,
« no previous file with comments | « dbus/bus.h ('k') | dbus/test_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698