зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1470795 Part 11 - Fix bug in record/replay channel initialization, r=mccr8.
--HG-- extra : rebase_source : 51aa6307326ffaf8fe1e169d94579b74b1ee3d89
This commit is contained in:
Родитель
f8489a95cf
Коммит
b0487e5938
|
@ -59,7 +59,7 @@ struct HelloMessage
|
|||
int32_t mMagic;
|
||||
};
|
||||
|
||||
Channel::Channel(size_t aId, const MessageHandler& aHandler)
|
||||
Channel::Channel(size_t aId, bool aMiddlemanRecording, const MessageHandler& aHandler)
|
||||
: mId(aId)
|
||||
, mHandler(aHandler)
|
||||
, mInitialized(false)
|
||||
|
@ -86,7 +86,7 @@ Channel::Channel(size_t aId, const MessageHandler& aHandler)
|
|||
MOZ_RELEASE_ASSERT(IsMiddleman());
|
||||
|
||||
ipc::FileDescriptor connection;
|
||||
if (mId == RecordingId) {
|
||||
if (aMiddlemanRecording) {
|
||||
// When starting the recording child process we have not done enough
|
||||
// initialization to ask for a channel from the parent, but have also not
|
||||
// started the sandbox so we can do it ourselves.
|
||||
|
|
|
@ -401,10 +401,6 @@ public:
|
|||
// called on the channel's message thread.
|
||||
typedef std::function<void(Message*)> MessageHandler;
|
||||
|
||||
// The recording channel is opened at startup and is initialized differently
|
||||
// from other channels.
|
||||
static const size_t RecordingId = 0;
|
||||
|
||||
private:
|
||||
// ID for this channel, unique for the middleman.
|
||||
size_t mId;
|
||||
|
@ -443,7 +439,7 @@ private:
|
|||
public:
|
||||
// Initialize this channel, connect to the other side, and spin up a thread
|
||||
// to process incoming messages by calling aHandler.
|
||||
Channel(size_t aId, const MessageHandler& aHandler);
|
||||
Channel(size_t aId, bool aMiddlemanRecording, const MessageHandler& aHandler);
|
||||
|
||||
size_t GetId() { return mId; }
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ InitRecordingOrReplayingProcess(int* aArgc, char*** aArgv)
|
|||
pt.emplace();
|
||||
|
||||
gMonitor = new Monitor();
|
||||
gChannel = new Channel(channelID.ref(), ChannelMessageHandler);
|
||||
gChannel = new Channel(channelID.ref(), /* aMiddlemanRecording = */ false, ChannelMessageHandler);
|
||||
|
||||
pt.reset();
|
||||
|
||||
|
|
|
@ -448,13 +448,12 @@ void
|
|||
ChildProcessInfo::LaunchSubprocess()
|
||||
{
|
||||
size_t channelId = gNumChannels++;
|
||||
MOZ_RELEASE_ASSERT((channelId == Channel::RecordingId) == IsRecording());
|
||||
|
||||
// Create a new channel every time we launch a new subprocess, without
|
||||
// deleting or tearing down the old one's state. This is pretty lame and it
|
||||
// would be nice if we could do something better here, especially because
|
||||
// with restarts we could create any number of channels over time.
|
||||
mChannel = new Channel(channelId, [=](Message* aMsg) {
|
||||
mChannel = new Channel(channelId, IsRecording(), [=](Message* aMsg) {
|
||||
ReceiveChildMessageOnMainThread(channelId, aMsg);
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче