Merge pull request #793 from lioncash/priv

ipc_helpers: Make member variables of ResponseBuilder private
This commit is contained in:
bunnei 2018-07-23 21:23:27 -07:00 committed by GitHub
commit 2f029577c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 17 deletions

View File

@ -25,9 +25,9 @@ protected:
ptrdiff_t index = 0; ptrdiff_t index = 0;
public: public:
RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {}
RequestHelperBase(Kernel::HLERequestContext& context) explicit RequestHelperBase(Kernel::HLERequestContext& context)
: context(&context), cmdbuf(context.CommandBuffer()) {} : context(&context), cmdbuf(context.CommandBuffer()) {}
void Skip(unsigned size_in_words, bool set_to_null) { void Skip(unsigned size_in_words, bool set_to_null) {
@ -56,13 +56,6 @@ public:
class ResponseBuilder : public RequestHelperBase { class ResponseBuilder : public RequestHelperBase {
public: public:
ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {}
u32 normal_params_size{};
u32 num_handles_to_copy{};
u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent
std::ptrdiff_t datapayload_index{};
/// Flags used for customizing the behavior of ResponseBuilder /// Flags used for customizing the behavior of ResponseBuilder
enum class Flags : u32 { enum class Flags : u32 {
None = 0, None = 0,
@ -71,7 +64,9 @@ public:
AlwaysMoveHandles = 1, AlwaysMoveHandles = 1,
}; };
ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, explicit ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {}
explicit ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size,
u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0,
Flags flags = Flags::None) Flags flags = Flags::None)
@ -206,6 +201,12 @@ public:
template <typename... O> template <typename... O>
void PushCopyObjects(Kernel::SharedPtr<O>... pointers); void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
private:
u32 normal_params_size{};
u32 num_handles_to_copy{};
u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent
std::ptrdiff_t datapayload_index{};
}; };
/// Push /// /// Push ///
@ -273,9 +274,9 @@ inline void ResponseBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
class RequestParser : public RequestHelperBase { class RequestParser : public RequestHelperBase {
public: public:
RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {}
RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { explicit RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) {
ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete"); ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete");
Skip(context.GetDataPayloadOffset(), false); Skip(context.GetDataPayloadOffset(), false);
// Skip the u64 command id, it's already stored in the context // Skip the u64 command id, it's already stored in the context
@ -285,8 +286,9 @@ public:
ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy, ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy,
u32 num_handles_to_move, u32 num_handles_to_move,
ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) { ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) const {
return {*context, normal_params_size, num_handles_to_copy, num_handles_to_move, flags}; return ResponseBuilder{*context, normal_params_size, num_handles_to_copy,
num_handles_to_move, flags};
} }
template <typename T> template <typename T>

View File

@ -91,7 +91,7 @@ protected:
*/ */
class HLERequestContext { class HLERequestContext {
public: public:
HLERequestContext(SharedPtr<Kernel::ServerSession> session); explicit HLERequestContext(SharedPtr<ServerSession> session);
~HLERequestContext(); ~HLERequestContext();
/// Returns a pointer to the IPC command buffer for this request. /// Returns a pointer to the IPC command buffer for this request.