#include "dbus/object_proxy.h"
#include <stddef.h>
#include <utility>
#include "base/containers/contains.h"
#include "base/debug/alias.h"
#include "base/debug/leak_annotations.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "dbus/bus.h"
#include "dbus/dbus_statistics.h"
#include "dbus/error.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/scoped_dbus_error.h"
#include "dbus/util.h"
namespace dbus {
namespace {
constexpr char kErrorServiceUnknown[] = …;
constexpr char kErrorObjectUnknown[] = …;
constexpr char kDBusSystemObjectPath[] = …;
constexpr char kDBusSystemObjectInterface[] = …;
constexpr char kDBusSystemObjectAddress[] = …;
constexpr char kNameOwnerChangedMember[] = …;
}
ObjectProxy::ReplyCallbackHolder::ReplyCallbackHolder(
scoped_refptr<base::SequencedTaskRunner> origin_task_runner,
ResponseOrErrorCallback callback)
: … { … }
ObjectProxy::ReplyCallbackHolder::ReplyCallbackHolder(
ReplyCallbackHolder&& other) = default;
ObjectProxy::ReplyCallbackHolder::~ReplyCallbackHolder() { … }
ObjectProxy::ResponseOrErrorCallback
ObjectProxy::ReplyCallbackHolder::ReleaseCallback() { … }
ObjectProxy::ObjectProxy(Bus* bus,
const std::string& service_name,
const ObjectPath& object_path,
int options)
: … { … }
ObjectProxy::~ObjectProxy() { … }
base::expected<std::unique_ptr<Response>, Error>
ObjectProxy::CallMethodAndBlock(MethodCall* method_call, int timeout_ms) { … }
void ObjectProxy::CallMethod(MethodCall* method_call,
int timeout_ms,
ResponseCallback callback) { … }
void ObjectProxy::CallMethodWithErrorResponse(
MethodCall* method_call,
int timeout_ms,
ResponseOrErrorCallback callback) { … }
void ObjectProxy::CallMethodWithErrorCallback(MethodCall* method_call,
int timeout_ms,
ResponseCallback callback,
ErrorCallback error_callback) { … }
void ObjectProxy::ConnectToSignal(const std::string& interface_name,
const std::string& signal_name,
SignalCallback signal_callback,
OnConnectedCallback on_connected_callback) { … }
bool ObjectProxy::ConnectToSignalAndBlock(const std::string& interface_name,
const std::string& signal_name,
SignalCallback signal_callback) { … }
void ObjectProxy::SetNameOwnerChangedCallback(
NameOwnerChangedCallback callback) { … }
void ObjectProxy::WaitForServiceToBeAvailable(
WaitForServiceToBeAvailableCallback callback) { … }
void ObjectProxy::Detach() { … }
void ObjectProxy::StartAsyncMethodCall(int timeout_ms,
DBusMessage* request_message,
ReplyCallbackHolder callback_holder) { … }
void ObjectProxy::OnPendingCallIsComplete(ReplyCallbackHolder callback_holder,
DBusPendingCall* pending_call) { … }
void ObjectProxy::RunResponseOrErrorCallback(
ReplyCallbackHolder callback_holder,
Response* response,
ErrorResponse* error_response) { … }
bool ObjectProxy::ConnectToNameOwnerChangedSignal() { … }
void ObjectProxy::TryConnectToNameOwnerChangedSignal() { … }
void ObjectProxy::WaitForServiceToBeAvailableInternal() { … }
DBusHandlerResult ObjectProxy::HandleMessage(DBusConnection* connection,
DBusMessage* raw_message) { … }
void ObjectProxy::RunMethod(std::vector<SignalCallback> signal_callbacks,
Signal* signal) { … }
DBusHandlerResult ObjectProxy::HandleMessageThunk(DBusConnection* connection,
DBusMessage* raw_message,
void* user_data) { … }
void ObjectProxy::LogMethodCallFailure(
const std::string_view& interface_name,
const std::string_view& method_name,
const std::string_view& error_name,
const std::string_view& error_message) const { … }
void ObjectProxy::OnCallMethod(const std::string& interface_name,
const std::string& method_name,
ResponseCallback response_callback,
Response* response,
ErrorResponse* error_response) { … }
bool ObjectProxy::AddMatchRuleWithCallback(
const std::string& match_rule,
const std::string& absolute_signal_name,
SignalCallback signal_callback) { … }
bool ObjectProxy::AddMatchRuleWithoutCallback(
const std::string& match_rule,
const std::string& absolute_signal_name) { … }
void ObjectProxy::UpdateNameOwnerAndBlock() { … }
DBusHandlerResult ObjectProxy::HandleNameOwnerChanged(
std::unique_ptr<Signal> signal) { … }
void ObjectProxy::RunNameOwnerChangedCallback(const std::string& old_owner,
const std::string& new_owner) { … }
void ObjectProxy::RunWaitForServiceToBeAvailableCallbacks(
bool service_is_available) { … }
}