#include <string>
#include <vector>
-#include "base/callback.h"
+#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_piece.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
+#include "base/types/expected.h"
#include "dbus/dbus_export.h"
+#include "dbus/error.h"
#include "dbus/object_path.h"
namespace dbus {
class ErrorResponse;
class MethodCall;
class Response;
-class ScopedDBusError;
class Signal;
// ObjectProxy is used to communicate with remote objects, mainly for
base::OnceCallback<void(const std::string&, const std::string&, bool)>;
// Calls the method of the remote object and blocks until the response
- // is returned. Returns NULL on error with the error details specified
- // in the |error| object.
+ // is returned.
//
- // BLOCKING CALL.
- virtual std::unique_ptr<Response> CallMethodAndBlockWithErrorDetails(
- MethodCall* method_call,
- int timeout_ms,
- ScopedDBusError* error);
-
- // Calls the method of the remote object and blocks until the response
- // is returned. Returns NULL on error.
+ // If this is failing due to the reason outside of libdbus, this may return
+ // an invalid error to indicate the situation.
+ // This must be called on D-Bus thread.
//
// BLOCKING CALL.
- virtual std::unique_ptr<Response> CallMethodAndBlock(MethodCall* method_call,
- int timeout_ms);
+ virtual base::expected<std::unique_ptr<Response>, Error> CallMethodAndBlock(
+ MethodCall* method_call,
+ int timeout_ms);
// Requests to call the method of the remote object.
//
// CallMethod().
void StartAsyncMethodCall(int timeout_ms,
DBusMessage* request_message,
- ReplyCallbackHolder callback_holder,
- base::TimeTicks start_time);
+ ReplyCallbackHolder callback_holder);
// Called when the pending call is complete.
void OnPendingCallIsComplete(ReplyCallbackHolder callback_holder,
- base::TimeTicks start_time,
DBusPendingCall* pending_call);
// Runs the ResponseOrErrorCallback with the given response object.
- void RunResponseOrErrorCallback(ReplyCallbackHolder callback_holderk,
- base::TimeTicks start_time,
+ void RunResponseOrErrorCallback(ReplyCallbackHolder callback_holder,
Response* response,
ErrorResponse* error_response);
DBusMessage* raw_message);
// Runs the method. Helper function for HandleMessage().
- void RunMethod(base::TimeTicks start_time,
- std::vector<SignalCallback> signal_callbacks,
- Signal* signal);
+ void RunMethod(std::vector<SignalCallback> signal_callbacks, Signal* signal);
// Redirects the function call to HandleMessage().
static DBusHandlerResult HandleMessageThunk(DBusConnection* connection,