mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 10:54:33 +00:00
Bug 648935: Need to use the "remote stack depth view" when deciding whether to undefer, too. r=bsmedberg
This commit is contained in:
parent
2724d954fd
commit
705e9bc07a
@ -330,7 +330,7 @@ RPCChannel::MaybeUndeferIncall()
|
||||
RPC_ASSERT(mDeferred.top().rpc_remote_stack_depth_guess() <= stackDepth,
|
||||
"fatal logic error");
|
||||
|
||||
if (mDeferred.top().rpc_remote_stack_depth_guess() < stackDepth)
|
||||
if (mDeferred.top().rpc_remote_stack_depth_guess() < RemoteViewOfStackDepth(stackDepth))
|
||||
return;
|
||||
|
||||
// maybe time to process this message
|
||||
@ -435,6 +435,13 @@ RPCChannel::OnMaybeDequeueOne()
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t
|
||||
RPCChannel::RemoteViewOfStackDepth(size_t stackDepth) const
|
||||
{
|
||||
AssertWorkerThread();
|
||||
return stackDepth - mOutOfTurnReplies.size();
|
||||
}
|
||||
|
||||
void
|
||||
RPCChannel::Incall(const Message& call, size_t stackDepth)
|
||||
{
|
||||
@ -445,14 +452,7 @@ RPCChannel::Incall(const Message& call, size_t stackDepth)
|
||||
// Race detection: see the long comment near
|
||||
// mRemoteStackDepthGuess in RPCChannel.h. "Remote" stack depth
|
||||
// means our side, and "local" means other side.
|
||||
//
|
||||
// We compare the remote stack depth guess against the "remote
|
||||
// view of stack depth" because of out-of-turn replies. When we
|
||||
// receive one, our actual RPC stack depth doesn't decrease, but
|
||||
// the other side (that sent the reply) thinks it has. So, just
|
||||
// adjust down by the number of out-of-turn replies.
|
||||
size_t remoteViewOfStackDepth = (stackDepth - mOutOfTurnReplies.size());
|
||||
if (call.rpc_remote_stack_depth_guess() != remoteViewOfStackDepth) {
|
||||
if (call.rpc_remote_stack_depth_guess() != RemoteViewOfStackDepth(stackDepth)) {
|
||||
// RPC in-calls have raced.
|
||||
// the "winner", if there is one, gets to defer processing of
|
||||
// the other side's in-call
|
||||
|
@ -207,6 +207,18 @@ protected:
|
||||
*/
|
||||
bool OnMaybeDequeueOne();
|
||||
|
||||
/**
|
||||
* The "remote view of stack depth" can be different than the
|
||||
* actual stack depth when there are out-of-turn replies. When we
|
||||
* receive one, our actual RPC stack depth doesn't decrease, but
|
||||
* the other side (that sent the reply) thinks it has. So, the
|
||||
* "view" returned here is |stackDepth| minus the number of
|
||||
* out-of-turn replies.
|
||||
*
|
||||
* Only called from the worker thread.
|
||||
*/
|
||||
size_t RemoteViewOfStackDepth(size_t stackDepth) const;
|
||||
|
||||
void Incall(const Message& call, size_t stackDepth);
|
||||
void DispatchIncall(const Message& call);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user