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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 response ? 1 : 0, | 273 response ? 1 : 0, |
274 kSuccessRatioHistogramMaxValue); | 274 kSuccessRatioHistogramMaxValue); |
275 | 275 |
276 // Check if the bus is still connected. If the method takes long to | 276 // Check if the bus is still connected. If the method takes long to |
277 // complete, the bus may be shut down meanwhile. | 277 // complete, the bus may be shut down meanwhile. |
278 if (!bus_->is_connected()) | 278 if (!bus_->is_connected()) |
279 return; | 279 return; |
280 | 280 |
281 if (!response) { | 281 if (!response) { |
282 // Something bad happened in the method call. | 282 // Something bad happened in the method call. |
283 scoped_ptr<dbus::ErrorResponse> error_response( | 283 scoped_ptr<ErrorResponse> error_response( |
284 ErrorResponse::FromMethodCall( | 284 ErrorResponse::FromMethodCall( |
285 method_call.get(), | 285 method_call.get(), |
286 DBUS_ERROR_FAILED, | 286 DBUS_ERROR_FAILED, |
287 "error occurred in " + method_call->GetMember())); | 287 "error occurred in " + method_call->GetMember())); |
288 bus_->Send(error_response->raw_message(), NULL); | 288 bus_->Send(error_response->raw_message(), NULL); |
289 return; | 289 return; |
290 } | 290 } |
291 | 291 |
292 // The method call was successful. | 292 // The method call was successful. |
293 bus_->Send(response->raw_message(), NULL); | 293 bus_->Send(response->raw_message(), NULL); |
(...skipping 14 matching lines...) Expand all Loading... |
308 return self->HandleMessage(connection, raw_message); | 308 return self->HandleMessage(connection, raw_message); |
309 } | 309 } |
310 | 310 |
311 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, | 311 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, |
312 void* user_data) { | 312 void* user_data) { |
313 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); | 313 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); |
314 return self->OnUnregistered(connection); | 314 return self->OnUnregistered(connection); |
315 } | 315 } |
316 | 316 |
317 } // namespace dbus | 317 } // namespace dbus |
OLD | NEW |