ipc/ipdl/test/cxx/TestRacyReentry.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #include "TestRacyReentry.h"
     3 #include "IPDLUnitTests.h"      // fail etc.
     5 namespace mozilla {
     6 namespace _ipdltest {
     8 //-----------------------------------------------------------------------------
     9 // parent
    11 TestRacyReentryParent::TestRacyReentryParent() : mRecvdE(false)
    12 {
    13     MOZ_COUNT_CTOR(TestRacyReentryParent);
    14 }
    16 TestRacyReentryParent::~TestRacyReentryParent()
    17 {
    18     MOZ_COUNT_DTOR(TestRacyReentryParent);
    19 }
    21 void
    22 TestRacyReentryParent::Main()
    23 {
    24     if (!SendStart())
    25         fail("sending Start");
    27     if (!SendN())
    28         fail("sending N");
    29 }
    31 bool
    32 TestRacyReentryParent::AnswerE()
    33 {
    34     if (!mRecvdE) {
    35         mRecvdE = true;
    36         return true;
    37     }
    39     if (!CallH())
    40         fail("calling H");
    42     return true;
    43 }
    45 //-----------------------------------------------------------------------------
    46 // child
    48 TestRacyReentryChild::TestRacyReentryChild()
    49 {
    50     MOZ_COUNT_CTOR(TestRacyReentryChild);
    51 }
    53 TestRacyReentryChild::~TestRacyReentryChild()
    54 {
    55     MOZ_COUNT_DTOR(TestRacyReentryChild);
    56 }
    58 bool
    59 TestRacyReentryChild::RecvStart()
    60 {
    61     if (!CallE())
    62         fail("calling E");
    64     Close();
    66     return true;
    67 }
    69 bool
    70 TestRacyReentryChild::RecvN()
    71 {
    72     if (!CallE())
    73         fail("calling E");
    74     return true;
    75 }
    77 bool
    78 TestRacyReentryChild::AnswerH()
    79 {
    80     return true;
    81 }
    83 } // namespace _ipdltest
    84 } // namespace mozilla

mercurial