OLD | NEW |
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_EXPORTED_OBJECT_H_ | 5 #ifndef DBUS_EXPORTED_OBJECT_H_ |
6 #define DBUS_EXPORTED_OBJECT_H_ | 6 #define DBUS_EXPORTED_OBJECT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <map> | 10 #include <map> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // BLOCKING CALL. | 116 // BLOCKING CALL. |
117 bool Register(); | 117 bool Register(); |
118 | 118 |
119 // Handles the incoming request messages and dispatches to the exported | 119 // Handles the incoming request messages and dispatches to the exported |
120 // methods. | 120 // methods. |
121 DBusHandlerResult HandleMessage(DBusConnection* connection, | 121 DBusHandlerResult HandleMessage(DBusConnection* connection, |
122 DBusMessage* raw_message); | 122 DBusMessage* raw_message); |
123 | 123 |
124 // Runs the method. Helper function for HandleMessage(). | 124 // Runs the method. Helper function for HandleMessage(). |
125 void RunMethod(MethodCallCallback method_call_callback, | 125 void RunMethod(MethodCallCallback method_call_callback, |
126 MethodCall* method_call); | 126 MethodCall* method_call, |
| 127 base::TimeTicks start_time); |
| 128 |
| 129 // Called on completion of the method run from RunMethod(). |
| 130 // Takes ownership of |method_call| and |response|. |
| 131 void OnMethodCompleted(MethodCall* method_call, |
| 132 Response* response, |
| 133 base::TimeTicks start_time); |
127 | 134 |
128 // Called when the object is unregistered. | 135 // Called when the object is unregistered. |
129 void OnUnregistered(DBusConnection* connection); | 136 void OnUnregistered(DBusConnection* connection); |
130 | 137 |
131 // Redirects the function call to HandleMessage(). | 138 // Redirects the function call to HandleMessage(). |
132 static DBusHandlerResult HandleMessageThunk(DBusConnection* connection, | 139 static DBusHandlerResult HandleMessageThunk(DBusConnection* connection, |
133 DBusMessage* raw_message, | 140 DBusMessage* raw_message, |
134 void* user_data); | 141 void* user_data); |
135 | 142 |
136 // Redirects the function call to OnUnregistered(). | 143 // Redirects the function call to OnUnregistered(). |
137 static void OnUnregisteredThunk(DBusConnection* connection, | 144 static void OnUnregisteredThunk(DBusConnection* connection, |
138 void* user_data); | 145 void* user_data); |
139 | 146 |
140 Bus* bus_; | 147 Bus* bus_; |
141 std::string service_name_; | 148 std::string service_name_; |
142 std::string object_path_; | 149 std::string object_path_; |
143 bool object_is_registered_; | 150 bool object_is_registered_; |
144 dbus::Response* response_from_method_; | |
145 base::WaitableEvent on_method_is_called_; | |
146 | 151 |
147 // The method table where keys are absolute method names (i.e. interface | 152 // The method table where keys are absolute method names (i.e. interface |
148 // name + method name), and values are the corresponding callbacks. | 153 // name + method name), and values are the corresponding callbacks. |
149 typedef std::map<std::string, MethodCallCallback> MethodTable; | 154 typedef std::map<std::string, MethodCallCallback> MethodTable; |
150 MethodTable method_table_; | 155 MethodTable method_table_; |
151 }; | 156 }; |
152 | 157 |
153 } // namespace dbus | 158 } // namespace dbus |
154 | 159 |
155 #endif // DBUS_EXPORTED_OBJECT_H_ | 160 #endif // DBUS_EXPORTED_OBJECT_H_ |
OLD | NEW |