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 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "dbus/bus.h" | 17 #include "dbus/bus.h" |
17 #include "dbus/message.h" | 18 #include "dbus/message.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DCHECK(method_call); | 258 DCHECK(method_call); |
258 if (bus_->HasDBusThread()) { | 259 if (bus_->HasDBusThread()) { |
259 bus_->GetDBusTaskRunner()->PostTask( | 260 bus_->GetDBusTaskRunner()->PostTask( |
260 FROM_HERE, | 261 FROM_HERE, |
261 base::Bind(&ExportedObject::OnMethodCompleted, | 262 base::Bind(&ExportedObject::OnMethodCompleted, |
262 this, | 263 this, |
263 base::Passed(&method_call), | 264 base::Passed(&method_call), |
264 base::Passed(&response), | 265 base::Passed(&response), |
265 start_time)); | 266 start_time)); |
266 } else { | 267 } else { |
267 OnMethodCompleted(method_call.Pass(), response.Pass(), start_time); | 268 OnMethodCompleted(std::move(method_call), std::move(response), start_time); |
268 } | 269 } |
269 } | 270 } |
270 | 271 |
271 void ExportedObject::OnMethodCompleted(scoped_ptr<MethodCall> method_call, | 272 void ExportedObject::OnMethodCompleted(scoped_ptr<MethodCall> method_call, |
272 scoped_ptr<Response> response, | 273 scoped_ptr<Response> response, |
273 base::TimeTicks start_time) { | 274 base::TimeTicks start_time) { |
274 bus_->AssertOnDBusThread(); | 275 bus_->AssertOnDBusThread(); |
275 | 276 |
276 // Record if the method call is successful, or not. 1 if successful. | 277 // Record if the method call is successful, or not. 1 if successful. |
277 UMA_HISTOGRAM_ENUMERATION("DBus.ExportedMethodHandleSuccess", | 278 UMA_HISTOGRAM_ENUMERATION("DBus.ExportedMethodHandleSuccess", |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 return self->HandleMessage(connection, raw_message); | 314 return self->HandleMessage(connection, raw_message); |
314 } | 315 } |
315 | 316 |
316 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, | 317 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, |
317 void* user_data) { | 318 void* user_data) { |
318 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); | 319 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); |
319 return self->OnUnregistered(connection); | 320 return self->OnUnregistered(connection); |
320 } | 321 } |
321 | 322 |
322 } // namespace dbus | 323 } // namespace dbus |
OLD | NEW |