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/object_proxy.h" | 5 #include "dbus/object_proxy.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 const bool service_is_available = !service_name_owner_.empty(); | 452 const bool service_is_available = !service_name_owner_.empty(); |
453 if (service_is_available) { // Service is already available. | 453 if (service_is_available) { // Service is already available. |
454 bus_->GetOriginTaskRunner()->PostTask( | 454 bus_->GetOriginTaskRunner()->PostTask( |
455 FROM_HERE, | 455 FROM_HERE, |
456 base::Bind(&ObjectProxy::RunWaitForServiceToBeAvailableCallbacks, | 456 base::Bind(&ObjectProxy::RunWaitForServiceToBeAvailableCallbacks, |
457 this, service_is_available)); | 457 this, service_is_available)); |
458 return; | 458 return; |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 DBusHandlerResult ObjectProxy::HandleMessage( | 462 DBusHandlerResult ObjectProxy::HandleMessage(DBusConnection*, |
463 DBusConnection* connection, | 463 DBusMessage* raw_message) { |
464 DBusMessage* raw_message) { | |
465 bus_->AssertOnDBusThread(); | 464 bus_->AssertOnDBusThread(); |
466 | 465 |
467 if (dbus_message_get_type(raw_message) != DBUS_MESSAGE_TYPE_SIGNAL) | 466 if (dbus_message_get_type(raw_message) != DBUS_MESSAGE_TYPE_SIGNAL) |
468 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 467 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
469 | 468 |
470 // raw_message will be unrefed on exit of the function. Increment the | 469 // raw_message will be unrefed on exit of the function. Increment the |
471 // reference so we can use it in Signal. | 470 // reference so we can use it in Signal. |
472 dbus_message_ref(raw_message); | 471 dbus_message_ref(raw_message); |
473 std::unique_ptr<Signal> signal(Signal::FromRawMessage(raw_message)); | 472 std::unique_ptr<Signal> signal(Signal::FromRawMessage(raw_message)); |
474 | 473 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 bool service_is_available) { | 707 bool service_is_available) { |
709 bus_->AssertOnOriginThread(); | 708 bus_->AssertOnOriginThread(); |
710 | 709 |
711 std::vector<WaitForServiceToBeAvailableCallback> callbacks; | 710 std::vector<WaitForServiceToBeAvailableCallback> callbacks; |
712 callbacks.swap(wait_for_service_to_be_available_callbacks_); | 711 callbacks.swap(wait_for_service_to_be_available_callbacks_); |
713 for (size_t i = 0; i < callbacks.size(); ++i) | 712 for (size_t i = 0; i < callbacks.size(); ++i) |
714 callbacks[i].Run(service_is_available); | 713 callbacks[i].Run(service_is_available); |
715 } | 714 } |
716 | 715 |
717 } // namespace dbus | 716 } // namespace dbus |
OLD | NEW |