Chromium Code Reviews| 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/bus.h" | 5 #include "dbus/bus.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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 iter->second, | 516 iter->second, |
| 517 released_signal)); | 517 released_signal)); |
| 518 } else { | 518 } else { |
| 519 const base::TimeTicks start_time = base::TimeTicks::Now(); | 519 const base::TimeTicks start_time = base::TimeTicks::Now(); |
| 520 // If the D-Bus thread is not used, just call the callback on the | 520 // If the D-Bus thread is not used, just call the callback on the |
| 521 // current thread. Transfer the ownership of |signal| to RunMethod(). | 521 // current thread. Transfer the ownership of |signal| to RunMethod(). |
| 522 Signal* released_signal = signal.release(); | 522 Signal* released_signal = signal.release(); |
| 523 RunMethod(start_time, iter->second, released_signal); | 523 RunMethod(start_time, iter->second, released_signal); |
| 524 } | 524 } |
| 525 | 525 |
| 526 return DBUS_HANDLER_RESULT_HANDLED; | 526 // We don't return DBUS_HANDLER_RESULT_HANDLED for signals because other |
| 527 // objects may be interested in them. | |
|
Daniel Erat
2013/12/13 18:11:37
nit: maybe explicitly mention NameOwnerChanged her
hashimoto
2013/12/17 04:01:34
Added a comment.
| |
| 528 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | |
| 527 } | 529 } |
| 528 | 530 |
| 529 void ObjectProxy::RunMethod(base::TimeTicks start_time, | 531 void ObjectProxy::RunMethod(base::TimeTicks start_time, |
| 530 std::vector<SignalCallback> signal_callbacks, | 532 std::vector<SignalCallback> signal_callbacks, |
| 531 Signal* signal) { | 533 Signal* signal) { |
| 532 bus_->AssertOnOriginThread(); | 534 bus_->AssertOnOriginThread(); |
| 533 | 535 |
| 534 for (std::vector<SignalCallback>::iterator iter = signal_callbacks.begin(); | 536 for (std::vector<SignalCallback>::iterator iter = signal_callbacks.begin(); |
| 535 iter != signal_callbacks.end(); ++iter) | 537 iter != signal_callbacks.end(); ++iter) |
| 536 iter->Run(signal); | 538 iter->Run(signal); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 bool service_is_available) { | 694 bool service_is_available) { |
| 693 bus_->AssertOnOriginThread(); | 695 bus_->AssertOnOriginThread(); |
| 694 | 696 |
| 695 std::vector<WaitForServiceToBeAvailableCallback> callbacks; | 697 std::vector<WaitForServiceToBeAvailableCallback> callbacks; |
| 696 callbacks.swap(wait_for_service_to_be_available_callbacks_); | 698 callbacks.swap(wait_for_service_to_be_available_callbacks_); |
| 697 for (size_t i = 0; i < callbacks.size(); ++i) | 699 for (size_t i = 0; i < callbacks.size(); ++i) |
| 698 callbacks[i].Run(service_is_available); | 700 callbacks[i].Run(service_is_available); |
| 699 } | 701 } |
| 700 | 702 |
| 701 } // namespace dbus | 703 } // namespace dbus |
| OLD | NEW |