зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1778272 - Revert the change to the LoadInfo release function. r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D151103
This commit is contained in:
Родитель
4f87812c0f
Коммит
0cb9ae544a
|
@ -37,7 +37,11 @@ using namespace mozilla;
|
|||
// nsIconChannel methods
|
||||
nsIconChannel::nsIconChannel() {}
|
||||
|
||||
nsIconChannel::~nsIconChannel() {}
|
||||
nsIconChannel::~nsIconChannel() {
|
||||
if (mLoadInfo) {
|
||||
NS_ReleaseOnMainThread("nsIconChannel::mLoadInfo", mLoadInfo.forget());
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsIconChannel, nsIChannel, nsIRequest, nsIRequestObserver, nsIStreamListener)
|
||||
|
||||
|
|
|
@ -560,6 +560,9 @@ NS_IMPL_ISUPPORTS(nsIconChannel, nsIChannel, nsIRequest, nsIRequestObserver,
|
|||
nsIconChannel::nsIconChannel() {}
|
||||
|
||||
nsIconChannel::~nsIconChannel() {
|
||||
if (mLoadInfo) {
|
||||
NS_ReleaseOnMainThread("nsIconChannel::mLoadInfo", mLoadInfo.forget());
|
||||
}
|
||||
if (mLoadGroup) {
|
||||
NS_ReleaseOnMainThread("nsIconChannel::mLoadGroup", mLoadGroup.forget());
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ nsJARChannel::~nsJARChannel() {
|
|||
}
|
||||
|
||||
// Proxy release the following members to main thread.
|
||||
NS_ReleaseOnMainThread("nsJARChannel::mLoadInfo", mLoadInfo.forget());
|
||||
NS_ReleaseOnMainThread("nsJARChannel::mCallbacks", mCallbacks.forget());
|
||||
NS_ReleaseOnMainThread("nsJARChannel::mProgressSink", mProgressSink.forget());
|
||||
NS_ReleaseOnMainThread("nsJARChannel::mLoadGroup", mLoadGroup.forget());
|
||||
|
|
|
@ -757,41 +757,7 @@ void LoadInfo::ComputeIsThirdPartyContext(dom::WindowGlobalParent* aGlobal) {
|
|||
thirdPartyUtil->IsThirdPartyGlobal(aGlobal, &mIsThirdPartyContext);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(LoadInfo)
|
||||
|
||||
bool LoadInfo::DispatchRelease() {
|
||||
if (NS_IsMainThread()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NewNonOwningRunnableMethod("net::LoadInfo::Release",
|
||||
this, &LoadInfo::Release),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(MozExternalRefCountType)
|
||||
LoadInfo::Release() {
|
||||
nsrefcnt count = mRefCnt - 1;
|
||||
if (DispatchRelease()) {
|
||||
// Redispatched to main thread.
|
||||
return count;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(0 != mRefCnt, "dup release");
|
||||
count = --mRefCnt;
|
||||
NS_LOG_RELEASE(this, count, "LoadInfo");
|
||||
|
||||
if (0 == count) {
|
||||
mRefCnt = 1;
|
||||
delete (this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(LoadInfo, nsILoadInfo)
|
||||
NS_IMPL_ISUPPORTS(LoadInfo, nsILoadInfo)
|
||||
|
||||
void LoadInfo::ReleaseMembers() {
|
||||
mCSPEventListener = nullptr;
|
||||
|
|
|
@ -262,7 +262,6 @@ class LoadInfo final : public nsILoadInfo {
|
|||
void UpdateFrameBrowsingContextID(uint64_t aFrameBrowsingContextID) {
|
||||
mFrameBrowsingContextID = aFrameBrowsingContextID;
|
||||
}
|
||||
bool DispatchRelease();
|
||||
MOZ_NEVER_INLINE void ReleaseMembers();
|
||||
|
||||
// if you add a member, please also update the copy constructor and consider
|
||||
|
|
|
@ -56,7 +56,9 @@ nsBaseChannel::nsBaseChannel() : NeckoTargetHolder(nullptr) {
|
|||
mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
nsBaseChannel::~nsBaseChannel() {}
|
||||
nsBaseChannel::~nsBaseChannel() {
|
||||
NS_ReleaseOnMainThread("nsBaseChannel::mLoadInfo", mLoadInfo.forget());
|
||||
}
|
||||
|
||||
nsresult nsBaseChannel::Redirect(nsIChannel* newChannel, uint32_t redirectFlags,
|
||||
bool openNewChannel) {
|
||||
|
|
|
@ -95,6 +95,11 @@ ClassifierDummyChannel::ClassifierDummyChannel(nsIURI* aURI,
|
|||
SetLoadInfo(aLoadInfo);
|
||||
}
|
||||
|
||||
ClassifierDummyChannel::~ClassifierDummyChannel() {
|
||||
NS_ReleaseOnMainThread("ClassifierDummyChannel::mLoadInfo",
|
||||
mLoadInfo.forget());
|
||||
}
|
||||
|
||||
void ClassifierDummyChannel::AddClassificationFlags(
|
||||
uint32_t aClassificationFlags, bool aThirdParty) {
|
||||
if (aThirdParty) {
|
||||
|
|
|
@ -71,7 +71,7 @@ class ClassifierDummyChannel final : public nsIChannel,
|
|||
void AddClassificationFlags(uint32_t aClassificationFlags, bool aThirdParty);
|
||||
|
||||
private:
|
||||
~ClassifierDummyChannel() = default;
|
||||
~ClassifierDummyChannel();
|
||||
|
||||
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
|
|
@ -285,6 +285,7 @@ void HttpBaseChannel::ReleaseMainThreadOnlyReferences() {
|
|||
|
||||
nsTArray<nsCOMPtr<nsISupports>> arrayToRelease;
|
||||
arrayToRelease.AppendElement(mLoadGroup.forget());
|
||||
arrayToRelease.AppendElement(mLoadInfo.forget());
|
||||
arrayToRelease.AppendElement(mCallbacks.forget());
|
||||
arrayToRelease.AppendElement(mProgressSink.forget());
|
||||
arrayToRelease.AppendElement(mPrincipal.forget());
|
||||
|
|
|
@ -1226,6 +1226,7 @@ WebSocketChannel::~WebSocketChannel() {
|
|||
mListenerMT = nullptr;
|
||||
|
||||
NS_ReleaseOnMainThread("WebSocketChannel::mLoadGroup", mLoadGroup.forget());
|
||||
NS_ReleaseOnMainThread("WebSocketChannel::mLoadInfo", mLoadInfo.forget());
|
||||
NS_ReleaseOnMainThread("WebSocketChannel::mService", mService.forget());
|
||||
nsCOMPtr<nsIEventTarget> target;
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче