diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-24 03:02:37 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-24 03:02:37 +0000 |
commit | bd81f3fdcb27097d9ddc293dea09efd6de628f02 (patch) | |
tree | 5bc66e90c15ca9247f150fc67afd06a14fe155dd /dbus/test_service.cc | |
parent | dda6d0ddca97a3f4ba53decce35f26ec7305e3ac (diff) | |
download | chromium_src-bd81f3fdcb27097d9ddc293dea09efd6de628f02.zip chromium_src-bd81f3fdcb27097d9ddc293dea09efd6de628f02.tar.gz chromium_src-bd81f3fdcb27097d9ddc293dea09efd6de628f02.tar.bz2 |
Revert 111479 - chrome: dbus: support asynchronous method replies
BUG=chromium-os:23241
TEST=Unit tests and manual testing on device.
Change-Id: I4d665897687030f4ab2379e4f6ddb9b3ebe02af4
Review URL: http://codereview.chromium.org/8637002
TBR=vlaviano@chromium.org
Review URL: http://codereview.chromium.org/8682032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/test_service.cc')
-rw-r--r-- | dbus/test_service.cc | 48 |
1 files changed, 10 insertions, 38 deletions
diff --git a/dbus/test_service.cc b/dbus/test_service.cc index ea8e360..b0207b0 100644 --- a/dbus/test_service.cc +++ b/dbus/test_service.cc @@ -13,8 +13,8 @@ namespace dbus { -// Echo, SlowEcho, AsyncEcho, BrokenMethod. -const int TestService::kNumMethodsToExport = 4; +// Echo, SlowEcho, BrokenMethod. +const int TestService::kNumMethodsToExport = 3; TestService::Options::Options() { } @@ -148,15 +148,6 @@ void TestService::Run(MessageLoop* message_loop) { exported_object_->ExportMethod( "org.chromium.TestInterface", - "AsyncEcho", - base::Bind(&TestService::AsyncEcho, - base::Unretained(this)), - base::Bind(&TestService::OnExported, - base::Unretained(this))); - ++num_methods; - - exported_object_->ExportMethod( - "org.chromium.TestInterface", "BrokenMethod", base::Bind(&TestService::BrokenMethod, base::Unretained(this)), @@ -172,44 +163,25 @@ void TestService::Run(MessageLoop* message_loop) { message_loop->Run(); } -void TestService::Echo(MethodCall* method_call, - dbus::ExportedObject::ResponseSender response_sender) { +Response* TestService::Echo(MethodCall* method_call) { MessageReader reader(method_call); std::string text_message; - if (!reader.PopString(&text_message)) { - response_sender.Run(NULL); - return; - } + if (!reader.PopString(&text_message)) + return NULL; Response* response = Response::FromMethodCall(method_call); MessageWriter writer(response); writer.AppendString(text_message); - response_sender.Run(response); + return response; } -void TestService::SlowEcho( - MethodCall* method_call, - dbus::ExportedObject::ResponseSender response_sender) { +Response* TestService::SlowEcho(MethodCall* method_call) { base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); - Echo(method_call, response_sender); -} - -void TestService::AsyncEcho( - MethodCall* method_call, - dbus::ExportedObject::ResponseSender response_sender) { - // Schedule a call to Echo() to send an asynchronous response after we return. - message_loop()->PostDelayedTask(FROM_HERE, - base::Bind(&TestService::Echo, - base::Unretained(this), - method_call, - response_sender), - TestTimeouts::tiny_timeout_ms()); + return Echo(method_call); } -void TestService::BrokenMethod( - MethodCall* method_call, - dbus::ExportedObject::ResponseSender response_sender) { - response_sender.Run(NULL); +Response* TestService::BrokenMethod(MethodCall* method_call) { + return NULL; } } // namespace dbus |