ServerLink: move Read*/Attach* method implementations to LinkSender/Receiver

Change-Id: Ib4dec3348b1438bbdfbaf18146d8aebb1978c39c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9631
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
X512
2025-09-08 16:42:25 +00:00
committed by waddlesplash
parent 0f9d0e5cda
commit 647aba7574
7 changed files with 211 additions and 180 deletions
+2 -2
View File
@@ -10,8 +10,8 @@
namespace BPrivate {
class ServerLink;
class LinkReceiver;
class LinkSender;
};
/* Integer rect used to define a clipping rectangle. All bounds are inclusive. */
@@ -85,8 +85,8 @@ public:
private:
friend class BDirectWindow;
friend class BPrivate::ServerLink;
friend class BPrivate::LinkReceiver;
friend class BPrivate::LinkSender;
class Support;
friend class Support;
+2
View File
@@ -17,6 +17,7 @@
class BGradient;
class BString;
class BRegion;
class BShape;
namespace BPrivate {
@@ -39,6 +40,7 @@ class LinkReceiver {
status_t ReadString(BString& string, size_t* _length = NULL);
status_t ReadString(char* buffer, size_t bufferSize);
status_t ReadRegion(BRegion* region);
status_t ReadShape(BShape* shape);
status_t ReadGradient(BGradient** gradient);
template <class Type> status_t Read(Type *data)
+9 -1
View File
@@ -14,8 +14,13 @@
#include <OS.h>
class BGradient;
class BRegion;
class BShape;
namespace BPrivate {
class LinkSender {
public:
LinkSender(port_id sendport);
@@ -35,6 +40,9 @@ class LinkSender {
status_t Attach(const void *data, size_t size);
status_t AttachString(const char *string, int32 maxLength = -1);
status_t AttachRegion(const BRegion& region);
status_t AttachShape(BShape& shape);
status_t AttachGradient(const BGradient& gradient);
template <class Type> status_t Attach(const Type& data)
{
return Attach(&data, sizeof(Type));
+43 -1
View File
@@ -79,7 +79,7 @@ public:
status_t ReadRegion(BRegion* region);
status_t ReadShape(BShape* shape);
status_t ReadGradient(BGradient** _gradient);
template <class Type>
status_t Read(Type* data);
@@ -168,6 +168,27 @@ ServerLink::AttachString(const char* string, int32 length)
}
inline status_t
ServerLink::AttachRegion(const BRegion& region)
{
return fSender->AttachRegion(region);
}
inline status_t
ServerLink::AttachShape(BShape& shape)
{
return fSender->AttachShape(shape);
}
inline status_t
ServerLink::AttachGradient(const BGradient& gradient)
{
return fSender->AttachGradient(gradient);
}
template<class Type> status_t
ServerLink::Attach(const Type& data)
{
@@ -234,6 +255,27 @@ ServerLink::ReadString(char** _string, size_t* _length)
}
inline status_t
ServerLink::ReadRegion(BRegion* region)
{
return fReceiver->ReadRegion(region);
}
inline status_t
ServerLink::ReadShape(BShape* shape)
{
return fReceiver->ReadShape(shape);
}
inline status_t
ServerLink::ReadGradient(BGradient** _gradient)
{
return fReceiver->ReadGradient(_gradient);
}
template <class Type> status_t
ServerLink::Read(Type* data)
{