Prevent deadlocks when sending sync messages during urgent in-calls (bug 900062, r=cjones).

This commit is contained in:
David Anderson 2013-08-12 16:21:54 -07:00
Родитель cfda6833a9
Коммит 97dabc4cb4
4 изменённых файлов: 39 добавлений и 1 удалений

Просмотреть файл

@ -102,7 +102,13 @@ SyncChannel::ProcessUrgentMessages()
bool bool
SyncChannel::Send(Message* _msg, Message* reply) SyncChannel::Send(Message* _msg, Message* reply)
{ {
MOZ_ASSERT(!mPendingReply); if (mPendingReply) {
// This is a temporary hack in place, for e10s CPOWs, until bug 901789
// and the new followup RPC protocol land. Eventually this will become
// an assert again. See bug 900062 for details.
NS_ERROR("Nested sync messages are not supported");
return false;
}
nsAutoPtr<Message> msg(_msg); nsAutoPtr<Message> msg(_msg);

Просмотреть файл

@ -7,11 +7,14 @@ parent:
sync Test1() returns (uint32_t result); sync Test1() returns (uint32_t result);
async Test2(); async Test2();
sync Test3() returns (uint32_t result); sync Test3() returns (uint32_t result);
sync Test4_Begin();
sync Test4_NestedSync();
child: child:
async Start(); async Start();
urgent Reply1() returns (uint32_t result); urgent Reply1() returns (uint32_t result);
urgent Reply2() returns (uint32_t result); urgent Reply2() returns (uint32_t result);
urgent Test4_Reenter();
}; };
} // namespace _ipdltest } // namespace _ipdltest

Просмотреть файл

@ -59,6 +59,21 @@ TestUrgencyParent::RecvTest3(uint32_t *value)
return true; return true;
} }
bool
TestUrgencyParent::RecvTest4_Begin()
{
if (!CallTest4_Reenter())
fail("call Test4_Reenter");
return true;
}
bool
TestUrgencyParent::RecvTest4_NestedSync()
{
fail("nested sync not supported");
return false;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// child // child
@ -97,6 +112,9 @@ TestUrgencyChild::RecvStart()
if (result != 1000) if (result != 1000)
fail("wrong value from test3"); fail("wrong value from test3");
if (!SendTest4_Begin())
fail("calling SendTest4_Begin");
Close(); Close();
return true; return true;
@ -127,6 +145,14 @@ TestUrgencyChild::AnswerReply2(uint32_t *reply)
return true; return true;
} }
bool
TestUrgencyChild::AnswerTest4_Reenter()
{
if (SendTest4_NestedSync())
fail("sending nested sync messages not supported");
return true;
}
TestUrgencyChild::TestUrgencyChild() TestUrgencyChild::TestUrgencyChild()
: test_(0) : test_(0)
{ {

Просмотреть файл

@ -25,6 +25,8 @@ public:
bool RecvTest1(uint32_t *value); bool RecvTest1(uint32_t *value);
bool RecvTest2(); bool RecvTest2();
bool RecvTest3(uint32_t *value); bool RecvTest3(uint32_t *value);
bool RecvTest4_Begin();
bool RecvTest4_NestedSync();
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
{ {
@ -48,6 +50,7 @@ public:
bool RecvStart(); bool RecvStart();
bool AnswerReply1(uint32_t *reply); bool AnswerReply1(uint32_t *reply);
bool AnswerReply2(uint32_t *reply); bool AnswerReply2(uint32_t *reply);
bool AnswerTest4_Reenter();
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
{ {