Backed out changeset afe830d17d3e (bug 1320744) for frequently failing test_bug440572.html on Windows 8 x64 opt and pgo. r=backout

This commit is contained in:
Sebastian Hengst 2017-03-25 21:59:38 +01:00
Родитель b3d205b825
Коммит faac0ab26d
2 изменённых файлов: 12 добавлений и 51 удалений

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

@ -192,54 +192,40 @@ HttpChannelChild::HttpChannelChild()
HttpChannelChild::~HttpChannelChild()
{
LOG(("Destroying HttpChannelChild @%p\n", this));
ReleaseMainThreadOnlyReferences();
}
void
HttpChannelChild::ReleaseMainThreadOnlyReferences()
{
if (NS_IsMainThread()) {
// Already on main thread, let dtor to
// take care of releasing references
return;
}
nsTArray<nsCOMPtr<nsISupports>> arrayToRelease;
arrayToRelease.AppendElement(mCacheKey.forget());
NS_DispatchToMainThread(new ProxyReleaseRunnable(Move(arrayToRelease)));
}
//-----------------------------------------------------------------------------
// HttpChannelChild::nsISupports
//-----------------------------------------------------------------------------
// Override nsHashPropertyBag's AddRef: we don't need thread-safe refcnt
NS_IMPL_ADDREF(HttpChannelChild)
NS_IMETHODIMP_(MozExternalRefCountType) HttpChannelChild::Release()
{
nsrefcnt count = --mRefCnt;
MOZ_ASSERT(int32_t(count) >= 0, "dup release");
NS_LOG_RELEASE(this, count, "HttpChannelChild");
NS_PRECONDITION(0 != mRefCnt, "dup release");
NS_ASSERT_OWNINGTHREAD(HttpChannelChild);
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "HttpChannelChild");
// Normally we Send_delete in OnStopRequest, but when we need to retain the
// remote channel for security info IPDL itself holds 1 reference, so we
// Send_delete when refCnt==1. But if !mIPCOpen, then there's nobody to send
// to, so we fall through.
if (mKeptAlive && count == 1 && mIPCOpen) {
if (mKeptAlive && mRefCnt == 1 && mIPCOpen) {
mKeptAlive = false;
// We send a message to the parent, which calls SendDelete, and then the
// child calling Send__delete__() to finally drop the refcount to 0.
TrySendDeletingChannel();
SendDeletingChannel();
return 1;
}
if (count == 0) {
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
delete this;
return 0;
}
return count;
return mRefCnt;
}
NS_INTERFACE_MAP_BEGIN(HttpChannelChild)
@ -964,7 +950,7 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
} else {
// The parent process will respond by sending a DeleteSelf message and
// making sure not to send any more messages after that.
TrySendDeletingChannel();
SendDeletingChannel();
}
}
@ -1165,7 +1151,7 @@ HttpChannelChild::FailedAsyncOpen(const nsresult& status)
HandleAsyncAbort();
if (mIPCOpen) {
TrySendDeletingChannel();
SendDeletingChannel();
}
}
@ -2878,20 +2864,6 @@ HttpChannelChild::GetResponseSynthesized(bool* aSynthesized)
return NS_OK;
}
void
HttpChannelChild::TrySendDeletingChannel()
{
if (NS_IsMainThread()) {
Unused << PHttpChannelChild::SendDeletingChannel();
return;
}
DebugOnly<nsresult> rv =
NS_DispatchToMainThread(
NewNonOwningRunnableMethod(this, &HttpChannelChild::TrySendDeletingChannel));
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
void
HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr<nsHttpResponseHead>& aResponseHead,
nsIInputStream* aSynthesizedInput,

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

@ -163,14 +163,6 @@ protected:
NS_IMETHOD GetResponseSynthesized(bool* aSynthesized) override;
private:
// this section is for main-thread-only object
// all the references need to be proxy released on main thread.
nsCOMPtr<nsISupports> mCacheKey;
// Proxy release all members above on main thread.
void ReleaseMainThreadOnlyReferences();
private:
class OverrideRunnable : public Runnable {
@ -220,10 +212,6 @@ private:
void ForceIntercepted(nsIInputStream* aSynthesizedInput);
// Try send DeletingChannel message to parent side. Dispatch an async task to
// main thread if invoking on non-main thread.
void TrySendDeletingChannel();
RequestHeaderTuples mClientSetRequestHeaders;
nsCOMPtr<nsIChildChannel> mRedirectChannelChild;
RefPtr<InterceptStreamListener> mInterceptListener;
@ -235,6 +223,7 @@ private:
bool mCacheEntryAvailable;
uint32_t mCacheExpirationTime;
nsCString mCachedCharset;
nsCOMPtr<nsISupports> mCacheKey;
nsCString mProtocolVersion;