diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /ipc/ipdl/test/cxx/TestRacyReentry.cpp | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ipc/ipdl/test/cxx/TestRacyReentry.cpp')
-rw-r--r-- | ipc/ipdl/test/cxx/TestRacyReentry.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ipc/ipdl/test/cxx/TestRacyReentry.cpp b/ipc/ipdl/test/cxx/TestRacyReentry.cpp new file mode 100644 index 0000000000..4224018e11 --- /dev/null +++ b/ipc/ipdl/test/cxx/TestRacyReentry.cpp @@ -0,0 +1,63 @@ +#include "TestRacyReentry.h" + +#include "IPDLUnitTests.h" // fail etc. + +namespace mozilla { +namespace _ipdltest { + +//----------------------------------------------------------------------------- +// parent + +TestRacyReentryParent::TestRacyReentryParent() : mRecvdE(false) { + MOZ_COUNT_CTOR(TestRacyReentryParent); +} + +TestRacyReentryParent::~TestRacyReentryParent() { + MOZ_COUNT_DTOR(TestRacyReentryParent); +} + +void TestRacyReentryParent::Main() { + if (!SendStart()) fail("sending Start"); + + if (!SendN()) fail("sending N"); +} + +mozilla::ipc::IPCResult TestRacyReentryParent::AnswerE() { + if (!mRecvdE) { + mRecvdE = true; + return IPC_OK(); + } + + if (!CallH()) fail("calling H"); + + return IPC_OK(); +} + +//----------------------------------------------------------------------------- +// child + +TestRacyReentryChild::TestRacyReentryChild() { + MOZ_COUNT_CTOR(TestRacyReentryChild); +} + +TestRacyReentryChild::~TestRacyReentryChild() { + MOZ_COUNT_DTOR(TestRacyReentryChild); +} + +mozilla::ipc::IPCResult TestRacyReentryChild::RecvStart() { + if (!CallE()) fail("calling E"); + + Close(); + + return IPC_OK(); +} + +mozilla::ipc::IPCResult TestRacyReentryChild::RecvN() { + if (!CallE()) fail("calling E"); + return IPC_OK(); +} + +mozilla::ipc::IPCResult TestRacyReentryChild::AnswerH() { return IPC_OK(); } + +} // namespace _ipdltest +} // namespace mozilla |