ipc_helper: split PushMoveObjects and PushCopyObjects

This commit is contained in:
wwylele 2017-12-03 12:08:57 +02:00
parent 2664042325
commit fda023c9fa
3 changed files with 14 additions and 6 deletions

View file

@ -114,7 +114,10 @@ public:
void PushMoveHandles(H... handles); void PushMoveHandles(H... handles);
template <typename... O> template <typename... O>
void PushObjects(Kernel::SharedPtr<O>... pointers); void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
template <typename... O>
void PushMoveObjects(Kernel::SharedPtr<O>... pointers);
void PushCurrentPIDHandle(); void PushCurrentPIDHandle();
@ -187,7 +190,12 @@ inline void RequestBuilder::PushMoveHandles(H... handles) {
} }
template <typename... O> template <typename... O>
inline void RequestBuilder::PushObjects(Kernel::SharedPtr<O>... pointers) { inline void RequestBuilder::PushCopyObjects(Kernel::SharedPtr<O>... pointers) {
PushCopyHandles(context->AddOutgoingHandle(std::move(pointers))...);
}
template <typename... O>
inline void RequestBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
PushMoveHandles(context->AddOutgoingHandle(std::move(pointers))...); PushMoveHandles(context->AddOutgoingHandle(std::move(pointers))...);
} }

View file

@ -206,7 +206,7 @@ void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
ClientConnected(std::get<SharedPtr<ServerSession>>(sessions)); ClientConnected(std::get<SharedPtr<ServerSession>>(sessions));
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushObjects(std::get<SharedPtr<ClientSession>>(sessions)); rb.PushMoveObjects(std::get<SharedPtr<ClientSession>>(sessions));
} }
File::~File() {} File::~File() {}

View file

@ -66,7 +66,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushObjects(notification_semaphore); rb.PushCopyObjects(notification_semaphore);
LOG_WARNING(Service_SRV, "(STUBBED) called"); LOG_WARNING(Service_SRV, "(STUBBED) called");
} }
@ -114,7 +114,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
(*session)->GetObjectId()); (*session)->GetObjectId());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(session.Code()); rb.Push(session.Code());
rb.PushObjects(std::move(session).Unwrap()); rb.PushMoveObjects(std::move(session).Unwrap());
} else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) { } else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) {
LOG_WARNING(Service_SRV, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED", name.c_str()); LOG_WARNING(Service_SRV, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED", name.c_str());
// TODO(Subv): Put the caller guest thread to sleep until this port becomes available again. // TODO(Subv): Put the caller guest thread to sleep until this port becomes available again.
@ -204,7 +204,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushObjects(port.Unwrap()); rb.PushMoveObjects(port.Unwrap());
} }
SRV::SRV(std::shared_ptr<ServiceManager> service_manager) SRV::SRV(std::shared_ptr<ServiceManager> service_manager)