mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 542052: Add support for serializing/deserializing byte types. r=bent
This commit is contained in:
parent
1658024fad
commit
ec0791fe20
@ -51,6 +51,48 @@
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
struct ParamTraits<PRInt8>
|
||||
{
|
||||
typedef PRInt8 paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
const char* outp;
|
||||
if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult)))
|
||||
return false;
|
||||
|
||||
*aResult = *reinterpret_cast<const paramType*>(outp);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<PRUint8>
|
||||
{
|
||||
typedef PRUint8 paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
const char* outp;
|
||||
if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult)))
|
||||
return false;
|
||||
|
||||
*aResult = *reinterpret_cast<const paramType*>(outp);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsACString>
|
||||
{
|
||||
|
@ -6,11 +6,11 @@ namespace _ipdltest {
|
||||
protocol PTestSanity {
|
||||
|
||||
child:
|
||||
Ping(int zero, float zeroPtFive);
|
||||
Ping(int zero, float zeroPtFive, int8_t dummy);
|
||||
__delete__();
|
||||
|
||||
parent:
|
||||
Pong(int one, float zeroPtTwoFive);
|
||||
Pong(int one, float zeroPtTwoFive, uint8_t dummy);
|
||||
|
||||
|
||||
state PING:
|
||||
|
@ -21,13 +21,14 @@ TestSanityParent::~TestSanityParent()
|
||||
void
|
||||
TestSanityParent::Main()
|
||||
{
|
||||
if (!SendPing(0, 0.5f))
|
||||
if (!SendPing(0, 0.5f, 0))
|
||||
fail("sending Ping");
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TestSanityParent::RecvPong(const int& one, const float& zeroPtTwoFive)
|
||||
TestSanityParent::RecvPong(const int& one, const float& zeroPtTwoFive,
|
||||
const uint8_t&/*unused*/)
|
||||
{
|
||||
if (1 != one)
|
||||
fail("invalid argument `%d', should have been `1'", one);
|
||||
@ -55,7 +56,8 @@ TestSanityChild::~TestSanityChild()
|
||||
}
|
||||
|
||||
bool
|
||||
TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive)
|
||||
TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive,
|
||||
const int8_t&/*unused*/)
|
||||
{
|
||||
if (0 != zero)
|
||||
fail("invalid argument `%d', should have been `0'", zero);
|
||||
@ -63,7 +65,7 @@ TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive)
|
||||
if (0.5f != zeroPtFive)
|
||||
fail("invalid argument `%g', should have been `0.5'", zeroPtFive);
|
||||
|
||||
if (!SendPong(1, 0.25f))
|
||||
if (!SendPong(1, 0.25f, 0))
|
||||
fail("sending Pong");
|
||||
return true;
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ public:
|
||||
|
||||
protected:
|
||||
NS_OVERRIDE
|
||||
virtual bool RecvPong(const int& one, const float& zeroPtTwoFive);
|
||||
virtual bool RecvPong(const int& one, const float& zeroPtTwoFive,
|
||||
const uint8_t& dummy);
|
||||
|
||||
NS_OVERRIDE
|
||||
virtual void ActorDestroy(ActorDestroyReason why)
|
||||
@ -43,7 +44,8 @@ public:
|
||||
|
||||
protected:
|
||||
NS_OVERRIDE
|
||||
virtual bool RecvPing(const int& zero, const float& zeroPtFive);
|
||||
virtual bool RecvPing(const int& zero, const float& zeroPtFive,
|
||||
const int8_t& dummy);
|
||||
|
||||
NS_OVERRIDE
|
||||
virtual void ActorDestroy(ActorDestroyReason why)
|
||||
|
Loading…
Reference in New Issue
Block a user