diff options
author | vlaviano@chromium.org <vlaviano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 04:57:42 +0000 |
---|---|---|
committer | vlaviano@chromium.org <vlaviano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 04:57:42 +0000 |
commit | 9aa74ccbcaf9f29f03ca4f0dbccd896ef4098118 (patch) | |
tree | 353aaadbdf70b223d8e0cbe71572bd9814c7e580 /dbus/exported_object.h | |
parent | cb8a5468be6eb5072a8e9173b554448c0d06e111 (diff) | |
download | chromium_src-9aa74ccbcaf9f29f03ca4f0dbccd896ef4098118.zip chromium_src-9aa74ccbcaf9f29f03ca4f0dbccd896ef4098118.tar.gz chromium_src-9aa74ccbcaf9f29f03ca4f0dbccd896ef4098118.tar.bz2 |
chrome: dbus: support asynchronous method replies
BUG=chromium-os:23241
TEST=Unit tests and manual testing on device.
Change-Id: Iab009ddbd12dea1e12299ae0ddccd4e430d9cf97
Review URL: http://codereview.chromium.org/8728020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/exported_object.h')
-rw-r--r-- | dbus/exported_object.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/dbus/exported_object.h b/dbus/exported_object.h index bc67bcd..7ac2f88 100644 --- a/dbus/exported_object.h +++ b/dbus/exported_object.h @@ -38,9 +38,15 @@ class ExportedObject : public base::RefCountedThreadSafe<ExportedObject> { const std::string& service_name, const std::string& object_path); + // Called to send a response from an exported method. Response* is the + // response message. Callers should pass a NULL Response* in the event + // of an error that prevents the sending of a response. + typedef base::Callback<void (Response*)> ResponseSender; + // Called when an exported method is called. MethodCall* is the request - // message. - typedef base::Callback<Response* (MethodCall*)> MethodCallCallback; + // message. ResponseSender is the callback that should be used to send a + // response. + typedef base::Callback<void (MethodCall*, ResponseSender)> MethodCallCallback; // Called when method exporting is done. // Parameters: @@ -124,7 +130,14 @@ class ExportedObject : public base::RefCountedThreadSafe<ExportedObject> { MethodCall* method_call, base::TimeTicks start_time); - // Called on completion of the method run from RunMethod(). + // Callback invoked by service provider to send a response to a method call. + // Can be called immediately from a MethodCallCallback to implement a + // synchronous service or called later to implement an asynchronous service. + void SendResponse(base::TimeTicks start_time, + MethodCall* method_call, + Response* response); + + // Called on completion of the method run from SendResponse(). // Takes ownership of |method_call| and |response|. void OnMethodCompleted(MethodCall* method_call, Response* response, |