Bug 1503639 Part 8 - Handle middleman call messages directly when recovering, r=mccr8.

--HG--
extra : rebase_source : c1f90a50ced14a09e1a3492988f3d02adc13bc02
This commit is contained in:
Brian Hackett 2018-11-01 17:13:11 -10:00
Родитель e3503a74b9
Коммит aae0f91453
3 изменённых файлов: 21 добавлений и 7 удалений

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

@ -14,6 +14,7 @@
#include "File.h"
#include "JSControl.h"
#include "MiddlemanCall.h"
#include "Monitor.h"
namespace mozilla {
@ -463,6 +464,14 @@ typedef BinaryMessage<MessageType::MiddlemanCallRequest> MiddlemanCallRequestMes
typedef BinaryMessage<MessageType::MiddlemanCallResponse> MiddlemanCallResponseMessage;
typedef EmptyMessage<MessageType::ResetMiddlemanCalls> ResetMiddlemanCallsMessage;
static inline MiddlemanCallResponseMessage*
ProcessMiddlemanCallMessage(const MiddlemanCallRequestMessage& aMsg)
{
InfallibleVector<char> outputData;
ProcessMiddlemanCall(aMsg.BinaryData(), aMsg.BinaryDataSize(), &outputData);
return MiddlemanCallResponseMessage::New(outputData.begin(), outputData.length());
}
class Channel
{
public:

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

@ -301,7 +301,6 @@ ChildProcessInfo::SendMessage(const Message& aMsg)
case MessageType::RunToPoint:
case MessageType::DebuggerRequest:
case MessageType::SetBreakpoint:
case MessageType::MiddlemanCallResponse:
mMessages.emplaceBack(aMsg.Clone());
break;
default:
@ -414,10 +413,20 @@ ChildProcessInfo::OnIncomingRecoveryMessage(const Message& aMsg)
}
case MessageType::HitBreakpoint:
case MessageType::DebuggerResponse:
case MessageType::MiddlemanCallRequest:
SendNextRecoveryMessage();
break;
case MessageType::MiddlemanCallRequest: {
// Middleman call messages can arrive in different orders when recovering
// than they originally did in the original process, so handle them afresh
// even when recovering.
MiddlemanCallResponseMessage* response =
ProcessMiddlemanCallMessage((MiddlemanCallRequestMessage&) aMsg);
SendMessageRaw(*response);
free(response);
break;
}
case MessageType::ResetMiddlemanCalls:
ResetMiddlemanCalls();
break;
default:
MOZ_CRASH("Unexpected message during recovery");

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

@ -1265,11 +1265,7 @@ HitForcedPauseBreakpoints(bool aRecordingBoundary)
static void
RecvMiddlemanCallRequest(const MiddlemanCallRequestMessage& aMsg)
{
InfallibleVector<char> outputData;
ProcessMiddlemanCall(aMsg.BinaryData(), aMsg.BinaryDataSize(), &outputData);
MiddlemanCallResponseMessage* response =
MiddlemanCallResponseMessage::New(outputData.begin(), outputData.length());
MiddlemanCallResponseMessage* response = ProcessMiddlemanCallMessage(aMsg);
gActiveChild->SendMessage(*response);
free(response);
}