| 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/object_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.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/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 15 #include "base/task_runner_util.h" | 16 #include "base/task_runner_util.h" |
| 16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "dbus/bus.h" |
| 18 #include "dbus/dbus_statistics.h" | 20 #include "dbus/dbus_statistics.h" |
| 19 #include "dbus/message.h" | 21 #include "dbus/message.h" |
| 20 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
| 21 #include "dbus/object_proxy.h" | |
| 22 #include "dbus/scoped_dbus_error.h" | 23 #include "dbus/scoped_dbus_error.h" |
| 23 #include "dbus/util.h" | 24 #include "dbus/util.h" |
| 24 | 25 |
| 25 namespace dbus { | 26 namespace dbus { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown"; | 30 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown"; |
| 30 const char kErrorObjectUnknown[] = "org.freedesktop.DBus.Error.UnknownObject"; | 31 const char kErrorObjectUnknown[] = "org.freedesktop.DBus.Error.UnknownObject"; |
| 31 | 32 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 Signal::FromRawMessage(raw_message)); | 470 Signal::FromRawMessage(raw_message)); |
| 470 | 471 |
| 471 // Verify the signal comes from the object we're proxying for, this is | 472 // Verify the signal comes from the object we're proxying for, this is |
| 472 // our last chance to return DBUS_HANDLER_RESULT_NOT_YET_HANDLED and | 473 // our last chance to return DBUS_HANDLER_RESULT_NOT_YET_HANDLED and |
| 473 // allow other object proxies to handle instead. | 474 // allow other object proxies to handle instead. |
| 474 const ObjectPath path = signal->GetPath(); | 475 const ObjectPath path = signal->GetPath(); |
| 475 if (path != object_path_) { | 476 if (path != object_path_) { |
| 476 if (path.value() == kDBusSystemObjectPath && | 477 if (path.value() == kDBusSystemObjectPath && |
| 477 signal->GetMember() == kNameOwnerChangedMember) { | 478 signal->GetMember() == kNameOwnerChangedMember) { |
| 478 // Handle NameOwnerChanged separately | 479 // Handle NameOwnerChanged separately |
| 479 return HandleNameOwnerChanged(signal.Pass()); | 480 return HandleNameOwnerChanged(std::move(signal)); |
| 480 } | 481 } |
| 481 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 482 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
| 482 } | 483 } |
| 483 | 484 |
| 484 const std::string interface = signal->GetInterface(); | 485 const std::string interface = signal->GetInterface(); |
| 485 const std::string member = signal->GetMember(); | 486 const std::string member = signal->GetMember(); |
| 486 | 487 |
| 487 statistics::AddReceivedSignal(service_name_, interface, member); | 488 statistics::AddReceivedSignal(service_name_, interface, member); |
| 488 | 489 |
| 489 // Check if we know about the signal. | 490 // Check if we know about the signal. |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 bool service_is_available) { | 703 bool service_is_available) { |
| 703 bus_->AssertOnOriginThread(); | 704 bus_->AssertOnOriginThread(); |
| 704 | 705 |
| 705 std::vector<WaitForServiceToBeAvailableCallback> callbacks; | 706 std::vector<WaitForServiceToBeAvailableCallback> callbacks; |
| 706 callbacks.swap(wait_for_service_to_be_available_callbacks_); | 707 callbacks.swap(wait_for_service_to_be_available_callbacks_); |
| 707 for (size_t i = 0; i < callbacks.size(); ++i) | 708 for (size_t i = 0; i < callbacks.size(); ++i) |
| 708 callbacks[i].Run(service_is_available); | 709 callbacks[i].Run(service_is_available); |
| 709 } | 710 } |
| 710 | 711 |
| 711 } // namespace dbus | 712 } // namespace dbus |
| OLD | NEW |