ipc/ipdl/test/cxx/PTestRaceDeferral.ipdl

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.

michael@0 1 namespace mozilla {
michael@0 2 namespace _ipdltest {
michael@0 3
michael@0 4 intr protocol PTestRaceDeferral {
michael@0 5 parent:
michael@0 6 intr Lose();
michael@0 7
michael@0 8 child:
michael@0 9 async StartRace();
michael@0 10 intr Win();
michael@0 11 intr Rpc();
michael@0 12 async __delete__();
michael@0 13
michael@0 14 // Test that messages deferred due to race resolution are
michael@0 15 // re-considered when the winner makes later RPCs
michael@0 16
michael@0 17 // IPDL's type system can't express this protocol because the race
michael@0 18 // resolution causes state to diverge for multiple steps, so we'll
michael@0 19 // leave it "stateless"
michael@0 20 /*
michael@0 21 state START:
michael@0 22 send StartRace goto DEFER;
michael@0 23 state DEFER:
michael@0 24 call Win goto PARENT;
michael@0 25 answer Lose goto CHILD;
michael@0 26
michael@0 27 state PARENT:
michael@0 28 // 'Lose' is received here but deferred
michael@0 29 call Rpc goto PARENT_LOSE;
michael@0 30 state PARENT_LOSE:
michael@0 31 // Calling 'Rpc' undefers 'Lose', and it wins the "race" with 'Rpc'
michael@0 32 answer Lose goto DONE;
michael@0 33
michael@0 34 state CHILD:
michael@0 35 call Win goto CHILD_RPC;
michael@0 36 state CHILD_RPC:
michael@0 37 call Rpc goto DONE;
michael@0 38
michael@0 39 state DONE:
michael@0 40 send __delete__;
michael@0 41 */
michael@0 42 };
michael@0 43
michael@0 44 } // namespace _ipdltest
michael@0 45 } // namespace mozilla

mercurial