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

Side by Side Diff: dbus/test_service.h

Issue 8682032: Revert 111479 - chrome: dbus: support asynchronous method replies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dbus/exported_object.cc ('k') | dbus/test_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DBUS_TEST_SERVICE_H_ 5 #ifndef DBUS_TEST_SERVICE_H_
6 #define DBUS_TEST_SERVICE_H_ 6 #define DBUS_TEST_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "dbus/exported_object.h"
14 13
15 namespace base { 14 namespace base {
16 class MessageLoopProxy; 15 class MessageLoopProxy;
17 } 16 }
18 17
19 namespace dbus { 18 namespace dbus {
20 19
21 class Bus; 20 class Bus;
21 class ExportedObject;
22 class MethodCall; 22 class MethodCall;
23 class Response; 23 class Response;
24 24
25 // The test service is used for end-to-end tests. The service runs in a 25 // The test service is used for end-to-end tests. The service runs in a
26 // separate thread, so it does not interfere the test code that runs in 26 // separate thread, so it does not interfere the test code that runs in
27 // the main thread. 27 // the main thread.
28 // 28 //
29 // The test service exports an object with methods such as Echo() and 29 // The test service exports an object with methods such as Echo() and
30 // SlowEcho(). The object has ability to send "Test" signal. 30 // SlowEcho(). The object has ability to send "Test" signal.
31 class TestService : public base::Thread { 31 class TestService : public base::Thread {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 bool success); 82 bool success);
83 83
84 // base::Thread override. 84 // base::Thread override.
85 virtual void Run(MessageLoop* message_loop) OVERRIDE; 85 virtual void Run(MessageLoop* message_loop) OVERRIDE;
86 86
87 // 87 //
88 // Exported methods. 88 // Exported methods.
89 // 89 //
90 90
91 // Echos the text message received from the method call. 91 // Echos the text message received from the method call.
92 void Echo(MethodCall* method_call, 92 Response* Echo(MethodCall* method_call);
93 dbus::ExportedObject::ResponseSender response_sender);
94 93
95 // Echos the text message received from the method call, but sleeps for 94 // Echos the text message received from the method call, but sleeps for
96 // TestTimeouts::tiny_timeout_ms() before returning the response. 95 // TestTimeouts::tiny_timeout_ms() before returning the response.
97 void SlowEcho(MethodCall* method_call, 96 Response* SlowEcho(MethodCall* method_call);
98 dbus::ExportedObject::ResponseSender response_sender);
99
100 // Echos the text message received from the method call, but sends its
101 // response asynchronously after this callback has returned.
102 void AsyncEcho(MethodCall* method_call,
103 dbus::ExportedObject::ResponseSender response_sender);
104 97
105 // Returns NULL, instead of a valid Response. 98 // Returns NULL, instead of a valid Response.
106 void BrokenMethod(MethodCall* method_call, 99 Response* BrokenMethod(MethodCall* method_call);
107 dbus::ExportedObject::ResponseSender response_sender);
108 100
109 scoped_refptr<base::MessageLoopProxy> dbus_thread_message_loop_proxy_; 101 scoped_refptr<base::MessageLoopProxy> dbus_thread_message_loop_proxy_;
110 base::WaitableEvent on_all_methods_exported_; 102 base::WaitableEvent on_all_methods_exported_;
111 // The number of methods actually exported. 103 // The number of methods actually exported.
112 int num_exported_methods_; 104 int num_exported_methods_;
113 105
114 scoped_refptr<Bus> bus_; 106 scoped_refptr<Bus> bus_;
115 ExportedObject* exported_object_; 107 ExportedObject* exported_object_;
116 }; 108 };
117 109
118 } // namespace dbus 110 } // namespace dbus
119 111
120 #endif // DBUS_TEST_SERVICE_H_ 112 #endif // DBUS_TEST_SERVICE_H_
OLDNEW
« no previous file with comments | « dbus/exported_object.cc ('k') | dbus/test_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698