mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
1beb91ad2b
- Bug 1262671 - IPC sentinel checking (r=froydnj) (2bd39988fe) - Bug 1262671 - IPC ReadData/ReadBytes elimination (r=froydnj) (85b47baffd) - Bug 1272415: Don't include task.h everywhere. r=froydnj (6198aedfed) - Bug 1273312 - Add task.h to ipdl unit tests (r=khuey) (42b8d3bb90) - Bug 1268616 - Part 1: Check max message size before resizing. r=billm (6889a43e16) - Bug 1268616 - Part 2: Stop sending messages that are too large. r=billm (a68e6624be) - Bug 1268616 - Part 3: Reduce the maxmimum IPC message size. r=billm (581076632e) - Bug 1262671 - Use BufferList for Pickle (r=froydnj) (f61d8b233d) - Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) (cb1aca1708) - mfbt: BufferList: VC2013 fix (93da0d98f7)
129 lines
2.8 KiB
C++
129 lines
2.8 KiB
C++
#include "TestActorPunning.h"
|
|
|
|
#include "IPDLUnitTests.h" // fail etc.
|
|
#include "mozilla/unused.h"
|
|
|
|
namespace mozilla {
|
|
namespace _ipdltest {
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// parent
|
|
|
|
void
|
|
TestActorPunningParent::Main()
|
|
{
|
|
if (!SendStart())
|
|
fail("sending Start");
|
|
}
|
|
|
|
bool
|
|
TestActorPunningParent::RecvPun(PTestActorPunningSubParent* a, const Bad& bad)
|
|
{
|
|
if (a->SendBad())
|
|
fail("bad!");
|
|
fail("shouldn't have received this message in the first place");
|
|
return true;
|
|
}
|
|
|
|
PTestActorPunningPunnedParent*
|
|
TestActorPunningParent::AllocPTestActorPunningPunnedParent()
|
|
{
|
|
return new TestActorPunningPunnedParent();
|
|
}
|
|
|
|
bool
|
|
TestActorPunningParent::DeallocPTestActorPunningPunnedParent(PTestActorPunningPunnedParent* a)
|
|
{
|
|
delete a;
|
|
return true;
|
|
}
|
|
|
|
PTestActorPunningSubParent*
|
|
TestActorPunningParent::AllocPTestActorPunningSubParent()
|
|
{
|
|
return new TestActorPunningSubParent();
|
|
}
|
|
|
|
bool
|
|
TestActorPunningParent::DeallocPTestActorPunningSubParent(PTestActorPunningSubParent* a)
|
|
{
|
|
delete a;
|
|
return true;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// child
|
|
|
|
PTestActorPunningPunnedChild*
|
|
TestActorPunningChild::AllocPTestActorPunningPunnedChild()
|
|
{
|
|
return new TestActorPunningPunnedChild();
|
|
}
|
|
|
|
bool
|
|
TestActorPunningChild::DeallocPTestActorPunningPunnedChild(PTestActorPunningPunnedChild*)
|
|
{
|
|
fail("should have died by now");
|
|
return true;
|
|
}
|
|
|
|
PTestActorPunningSubChild*
|
|
TestActorPunningChild::AllocPTestActorPunningSubChild()
|
|
{
|
|
return new TestActorPunningSubChild();
|
|
}
|
|
|
|
bool
|
|
TestActorPunningChild::DeallocPTestActorPunningSubChild(PTestActorPunningSubChild*)
|
|
{
|
|
fail("should have died by now");
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
TestActorPunningChild::RecvStart()
|
|
{
|
|
SendPTestActorPunningSubConstructor();
|
|
SendPTestActorPunningPunnedConstructor();
|
|
PTestActorPunningSubChild* a = SendPTestActorPunningSubConstructor();
|
|
// We can't assert whether this succeeds or fails, due to race
|
|
// conditions.
|
|
SendPun(a, Bad());
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
TestActorPunningSubChild::RecvBad()
|
|
{
|
|
fail("things are going really badly right now");
|
|
return true;
|
|
}
|
|
|
|
|
|
} // namespace _ipdltest
|
|
} // namespace mozilla
|
|
|
|
namespace IPC {
|
|
using namespace mozilla::_ipdltest;
|
|
using namespace mozilla::ipc;
|
|
|
|
/*static*/ void
|
|
ParamTraits<Bad>::Write(Message* aMsg, const paramType& aParam)
|
|
{
|
|
// Skip past the sentinel for the actor as well as the actor.
|
|
int32_t* ptr = aMsg->GetInt32PtrForTest(2 * sizeof(int32_t));
|
|
ActorHandle* ah = reinterpret_cast<ActorHandle*>(ptr);
|
|
if (ah->mId != -3)
|
|
fail("guessed wrong offset (value is %d, should be -3)", ah->mId);
|
|
ah->mId = -2;
|
|
}
|
|
|
|
/*static*/ bool
|
|
ParamTraits<Bad>::Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
} // namespace IPC
|
|
|