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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // object, which is this exported object here. | 87 // object, which is this exported object here. |
88 CHECK(signal->SetPath(object_path_)); | 88 CHECK(signal->SetPath(object_path_)); |
89 | 89 |
90 // Increment the reference count so we can safely reference the | 90 // Increment the reference count so we can safely reference the |
91 // underlying signal message until the signal sending is complete. This | 91 // underlying signal message until the signal sending is complete. This |
92 // will be unref'ed in SendSignalInternal(). | 92 // will be unref'ed in SendSignalInternal(). |
93 DBusMessage* signal_message = signal->raw_message(); | 93 DBusMessage* signal_message = signal->raw_message(); |
94 dbus_message_ref(signal_message); | 94 dbus_message_ref(signal_message); |
95 | 95 |
96 const base::TimeTicks start_time = base::TimeTicks::Now(); | 96 const base::TimeTicks start_time = base::TimeTicks::Now(); |
97 if (bus_->GetDBusTaskRunner()->RunsTasksOnCurrentThread()) { | 97 if (bus_->GetDBusTaskRunner()->RunsTasksInCurrentSequence()) { |
98 // The Chrome OS power manager doesn't use a dedicated TaskRunner for | 98 // The Chrome OS power manager doesn't use a dedicated TaskRunner for |
99 // sending DBus messages. Sending signals asynchronously can cause an | 99 // sending DBus messages. Sending signals asynchronously can cause an |
100 // inversion in the message order if the power manager calls | 100 // inversion in the message order if the power manager calls |
101 // ObjectProxy::CallMethodAndBlock() before going back to the top level of | 101 // ObjectProxy::CallMethodAndBlock() before going back to the top level of |
102 // the MessageLoop: crbug.com/472361. | 102 // the MessageLoop: crbug.com/472361. |
103 SendSignalInternal(start_time, signal_message); | 103 SendSignalInternal(start_time, signal_message); |
104 } else { | 104 } else { |
105 bus_->GetDBusTaskRunner()->PostTask( | 105 bus_->GetDBusTaskRunner()->PostTask( |
106 FROM_HERE, | 106 FROM_HERE, |
107 base::Bind(&ExportedObject::SendSignalInternal, | 107 base::Bind(&ExportedObject::SendSignalInternal, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return self->HandleMessage(connection, raw_message); | 312 return self->HandleMessage(connection, raw_message); |
313 } | 313 } |
314 | 314 |
315 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, | 315 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, |
316 void* user_data) { | 316 void* user_data) { |
317 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); | 317 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); |
318 return self->OnUnregistered(connection); | 318 return self->OnUnregistered(connection); |
319 } | 319 } |
320 | 320 |
321 } // namespace dbus | 321 } // namespace dbus |
OLD | NEW |