Backed out 3 changesets (bug 1349699) for Android mozilla::ipc::MessageChannel::WillDestroyCurrentMessageLoop crashes

Backed out changeset 8a50c2d76afc (bug 1349699)
Backed out changeset 3b9eadd61e26 (bug 1349699)
Backed out changeset 16e000b3fe0c (bug 1349699)
This commit is contained in:
Phil Ringnalda 2017-04-03 21:07:49 -07:00
parent 24c39a87ef
commit 884bc64271
3 changed files with 4 additions and 38 deletions

View File

@ -488,10 +488,8 @@ private:
nsAutoPtr<IPC::Message> mReply;
};
MessageChannel::MessageChannel(const char* aName,
IToplevelProtocol *aListener)
: mName(aName),
mListener(aListener),
MessageChannel::MessageChannel(IToplevelProtocol *aListener)
: mListener(aListener),
mChannelState(ChannelClosed),
mSide(UnknownSide),
mLink(nullptr),
@ -629,16 +627,6 @@ MessageChannel::CanSend() const
return Connected();
}
void
MessageChannel::WillDestroyCurrentMessageLoop()
{
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProtocolName"),
nsDependentCString(mName));
#endif
MOZ_CRASH("MessageLoop destroyed before MessageChannel that's bound to it");
}
void
MessageChannel::Clear()
{
@ -652,22 +640,10 @@ MessageChannel::Clear()
// In practice, mListener owns the channel, so the channel gets deleted
// before mListener. But just to be safe, mListener is a weak pointer.
if (!Unsound_IsClosed()) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProtocolName"),
nsDependentCString(mName));
#endif
MOZ_CRASH("MessageChannel destroyed without being closed");
}
if (gParentProcessBlocker == this) {
gParentProcessBlocker = nullptr;
}
if (mWorkerLoop) {
mWorkerLoop->RemoveDestructionObserver(this);
}
mWorkerLoop = nullptr;
delete mLink;
mLink = nullptr;
@ -700,8 +676,6 @@ MessageChannel::Open(Transport* aTransport, MessageLoop* aIOLoop, Side aSide)
mWorkerLoop = MessageLoop::current();
mWorkerLoopID = mWorkerLoop->id();
mWorkerLoop->AddDestructionObserver(this);
ProcessLink *link = new ProcessLink(this);
link->Open(aTransport, aIOLoop, aSide); // :TODO: n.b.: sets mChild
mLink = link;
@ -778,7 +752,6 @@ MessageChannel::CommonThreadOpenInit(MessageChannel *aTargetChan, Side aSide)
{
mWorkerLoop = MessageLoop::current();
mWorkerLoopID = mWorkerLoop->id();
mWorkerLoop->AddDestructionObserver(this);
mLink = new ThreadLink(this, aTargetChan);
mSide = aSide;
}

View File

@ -72,7 +72,7 @@ enum ChannelState {
class AutoEnterTransaction;
class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver
class MessageChannel : HasResultCodes
{
friend class ProcessLink;
friend class ThreadLink;
@ -89,8 +89,7 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver
typedef IPC::MessageInfo MessageInfo;
typedef mozilla::ipc::Transport Transport;
explicit MessageChannel(const char *aName,
IToplevelProtocol *aListener);
explicit MessageChannel(IToplevelProtocol *aListener);
~MessageChannel();
IToplevelProtocol *Listener() const {
@ -492,12 +491,7 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver
typedef std::map<size_t, Message> MessageMap;
typedef IPC::Message::msgid_t msgid_t;
void WillDestroyCurrentMessageLoop() override;
private:
// This will be a string literal, so lifetime is not an issue.
const char* mName;
// Based on presumption the listener owns and overlives the channel,
// this is never nullified.
IToplevelProtocol* mListener;

View File

@ -2668,7 +2668,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ExprMemberInit(ExprVar('mozilla::ipc::IToplevelProtocol'),
[_protocolId(ptype), side]),
ExprMemberInit(p.channelVar(), [
ExprLiteral.String(_actorName(p.name, self.side)),
ExprCall(ExprVar('ALLOW_THIS_IN_INITIALIZER_LIST'),
[ ExprVar.THIS ]) ]),
ExprMemberInit(p.stateVar(),