diff --git a/src/ipc.cc b/src/ipc.cc index d20240e3..495ad307 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -104,3 +104,7 @@ const char* IpcIdToString(IpcId id) { BaseIpcMessage::BaseIpcMessage(IpcId method_id) : method_id(method_id) {} BaseIpcMessage::~BaseIpcMessage() = default; + +lsRequestId BaseIpcMessage::GetRequestId() { + return std::monostate(); +} diff --git a/src/ipc.h b/src/ipc.h index 7326e3a6..400e1b4b 100644 --- a/src/ipc.h +++ b/src/ipc.h @@ -75,6 +75,8 @@ struct BaseIpcMessage { BaseIpcMessage(IpcId method_id); virtual ~BaseIpcMessage(); + virtual lsRequestId GetRequestId(); + template T* As() { assert(method_id == T::kIpcId); @@ -87,6 +89,10 @@ struct RequestMessage : public BaseIpcMessage { // number | string, actually no null lsRequestId id; RequestMessage() : BaseIpcMessage(T::kIpcId) {} + + lsRequestId GetRequestId() override { + return id; + } }; // NotificationMessage does not have |id|.