| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 11 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 12 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 14 #include "dbus/bus.h" | 16 #include "dbus/bus.h" |
| 15 #include "dbus/message.h" | 17 #include "dbus/message.h" |
| 16 #include "dbus/object_path.h" | 18 #include "dbus/object_path.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 const std::string& interface_name, | 143 const std::string& interface_name, |
| 142 const std::string& method_name, | 144 const std::string& method_name, |
| 143 bool success) { | 145 bool success) { |
| 144 bus_->AssertOnOriginThread(); | 146 bus_->AssertOnOriginThread(); |
| 145 | 147 |
| 146 on_exported_callback.Run(interface_name, method_name, success); | 148 on_exported_callback.Run(interface_name, method_name, success); |
| 147 } | 149 } |
| 148 | 150 |
| 149 void ExportedObject::SendSignalInternal(base::TimeTicks start_time, | 151 void ExportedObject::SendSignalInternal(base::TimeTicks start_time, |
| 150 DBusMessage* signal_message) { | 152 DBusMessage* signal_message) { |
| 151 uint32 serial = 0; | 153 uint32_t serial = 0; |
| 152 bus_->Send(signal_message, &serial); | 154 bus_->Send(signal_message, &serial); |
| 153 dbus_message_unref(signal_message); | 155 dbus_message_unref(signal_message); |
| 154 // Record time spent to send the the signal. This is not accurate as the | 156 // Record time spent to send the the signal. This is not accurate as the |
| 155 // signal will actually be sent from the next run of the message loop, | 157 // signal will actually be sent from the next run of the message loop, |
| 156 // but we can at least tell the number of signals sent. | 158 // but we can at least tell the number of signals sent. |
| 157 UMA_HISTOGRAM_TIMES("DBus.SignalSendTime", | 159 UMA_HISTOGRAM_TIMES("DBus.SignalSendTime", |
| 158 base::TimeTicks::Now() - start_time); | 160 base::TimeTicks::Now() - start_time); |
| 159 } | 161 } |
| 160 | 162 |
| 161 bool ExportedObject::Register() { | 163 bool ExportedObject::Register() { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 return self->HandleMessage(connection, raw_message); | 313 return self->HandleMessage(connection, raw_message); |
| 312 } | 314 } |
| 313 | 315 |
| 314 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, | 316 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, |
| 315 void* user_data) { | 317 void* user_data) { |
| 316 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); | 318 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); |
| 317 return self->OnUnregistered(connection); | 319 return self->OnUnregistered(connection); |
| 318 } | 320 } |
| 319 | 321 |
| 320 } // namespace dbus | 322 } // namespace dbus |
| OLD | NEW |