OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "dbus/exported_object.h" | 5 #include "dbus/exported_object.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 LOG(ERROR) << "Failed to register the object: " << object_path_.value() | 180 LOG(ERROR) << "Failed to register the object: " << object_path_.value() |
181 << ": " << (error.is_set() ? error.message() : ""); | 181 << ": " << (error.is_set() ? error.message() : ""); |
182 return false; | 182 return false; |
183 } | 183 } |
184 | 184 |
185 object_is_registered_ = true; | 185 object_is_registered_ = true; |
186 return true; | 186 return true; |
187 } | 187 } |
188 | 188 |
189 DBusHandlerResult ExportedObject::HandleMessage( | 189 DBusHandlerResult ExportedObject::HandleMessage( |
190 DBusConnection* connection, | 190 DBusConnection* /* connection */, |
191 DBusMessage* raw_message) { | 191 DBusMessage* raw_message) { |
192 bus_->AssertOnDBusThread(); | 192 bus_->AssertOnDBusThread(); |
193 DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_CALL, dbus_message_get_type(raw_message)); | 193 DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_CALL, dbus_message_get_type(raw_message)); |
194 | 194 |
195 // raw_message will be unrefed on exit of the function. Increment the | 195 // raw_message will be unrefed on exit of the function. Increment the |
196 // reference so we can use it in MethodCall. | 196 // reference so we can use it in MethodCall. |
197 dbus_message_ref(raw_message); | 197 dbus_message_ref(raw_message); |
198 std::unique_ptr<MethodCall> method_call( | 198 std::unique_ptr<MethodCall> method_call( |
199 MethodCall::FromRawMessage(raw_message)); | 199 MethodCall::FromRawMessage(raw_message)); |
200 const std::string interface = method_call->GetInterface(); | 200 const std::string interface = method_call->GetInterface(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 | 295 |
296 // The method call was successful. | 296 // The method call was successful. |
297 bus_->Send(response->raw_message(), NULL); | 297 bus_->Send(response->raw_message(), NULL); |
298 | 298 |
299 // Record time spent to handle the the method call. Don't include failures. | 299 // Record time spent to handle the the method call. Don't include failures. |
300 UMA_HISTOGRAM_TIMES("DBus.ExportedMethodHandleTime", | 300 UMA_HISTOGRAM_TIMES("DBus.ExportedMethodHandleTime", |
301 base::TimeTicks::Now() - start_time); | 301 base::TimeTicks::Now() - start_time); |
302 } | 302 } |
303 | 303 |
304 void ExportedObject::OnUnregistered(DBusConnection* connection) { | 304 void ExportedObject::OnUnregistered(DBusConnection* /* connection */) {} |
305 } | |
306 | 305 |
307 DBusHandlerResult ExportedObject::HandleMessageThunk( | 306 DBusHandlerResult ExportedObject::HandleMessageThunk( |
308 DBusConnection* connection, | 307 DBusConnection* connection, |
309 DBusMessage* raw_message, | 308 DBusMessage* raw_message, |
310 void* user_data) { | 309 void* user_data) { |
311 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); | 310 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); |
312 return self->HandleMessage(connection, raw_message); | 311 return self->HandleMessage(connection, raw_message); |
313 } | 312 } |
314 | 313 |
315 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, | 314 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, |
316 void* user_data) { | 315 void* user_data) { |
317 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); | 316 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); |
318 return self->OnUnregistered(connection); | 317 return self->OnUnregistered(connection); |
319 } | 318 } |
320 | 319 |
321 } // namespace dbus | 320 } // namespace dbus |
OLD | NEW |