Bug 1605895 - Advance the diagnostic assertion to check status of background channel event queues, r=michal,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D80639
This commit is contained in:
Honza Bambas 2020-06-25 13:34:16 +00:00
Родитель 57c85830c8
Коммит 167432454e
3 изменённых файлов: 26 добавлений и 2 удалений

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

@ -70,6 +70,14 @@ void HttpBackgroundChannelChild::OnChannelClosed() {
LOG(("HttpBackgroundChannelChild::OnChannelClosed [this=%p]\n", this));
MOZ_ASSERT(OnSocketThread());
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (mChannelChild) {
mChannelChild->mBackgroundChildQueueFinalState =
mQueuedRunnables.IsEmpty() ? HttpChannelChild::BCKCHILD_EMPTY
: HttpChannelChild::BCKCHILD_NON_EMPTY;
}
#endif
// HttpChannelChild is not going to handle any incoming message.
mChannelChild = nullptr;

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

@ -175,6 +175,9 @@ HttpChannelChild::HttpChannelChild()
mIsRacing(false),
mCacheNeedToReportBytesReadInitialized(false),
mNeedToReportBytesRead(true),
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
mBackgroundChildQueueFinalState(BCKCHILD_UNKNOWN),
#endif
mCacheEntryAvailable(false),
mAltDataCacheEntryAvailable(false),
mSendResumeAt(false),
@ -228,10 +231,13 @@ HttpChannelChild::~HttpChannelChild() {
(mInterceptedRedirectListener ? 1 << 7 : 0) | (mCanceled ? 1 << 8 : 0) |
(mRedirectChannelChild ? 1 << 9 : 0) |
(mEventQ->IsEmpty() ? 1 << 10 : 0) | (nullBgChild ? 1 << 11 : 0) |
(emptyBgChildQueue ? 1 << 12 : 0);
(emptyBgChildQueue ? 1 << 12 : 0) |
(mOnStartRequestCalled ? 1 << 13 : 0) |
(mBackgroundChildQueueFinalState == BCKCHILD_EMPTY ? 1 << 14 : 0) |
(mBackgroundChildQueueFinalState == BCKCHILD_NON_EMPTY ? 1 << 15 : 0);
MOZ_CRASH_UNSAFE_PRINTF(
"~HttpChannelChild, mOnStopRequestCalled=false, mStatus=0x%08x, "
"mActorDestroyReason=%d, 20200601 flags=%u",
"mActorDestroyReason=%d, 20200618 flags=%u",
static_cast<uint32_t>(nsresult(mStatus)),
static_cast<int32_t>(mActorDestroyReason ? *mActorDestroyReason : -1),
flags);

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

@ -420,6 +420,16 @@ class HttpChannelChild final : public PHttpChannelChild,
bool mDoDiagnosticAssertWhenOnStopNotCalledOnDestroy = false;
bool mAsyncOpenSucceeded = false;
bool mSuccesfullyRedirected = false;
// State of the HttpBackgroundChannelChild's event queue during destruction.
enum BckChildQueueStatus {
// BckChild never told us
BCKCHILD_UNKNOWN,
// BckChild was empty at the time of destruction
BCKCHILD_EMPTY,
// BckChild was keeping events in the queue at the destruction time!
BCKCHILD_NON_EMPTY
};
Atomic<BckChildQueueStatus> mBackgroundChildQueueFinalState;
Maybe<ActorDestroyReason> mActorDestroyReason;
#endif