Bug 1384294 - replace GetMainThreadEventTarget with GetNeckoTarget in HttpChannelChild. r=mayhemer

GetMainThreadEventTarget doesn't label runnable with correct doc group or tab group.
In HttpChannelChild we should replace it with |GetNeckoTarget| in general.
By making mIsTrackingResource atomic, HttpChannelChild::ProcessNotifyTrackingResource can be
further changed to do direct function call without dispatching additional runnable on main thread.

MozReview-Commit-ID: LVvoiljHElX

--HG--
extra : rebase_source : 35e85c8afed1411cd60cf2c7ae5cb01cc05f80b2
This commit is contained in:
Shih-Chiang Chien 2017-07-26 15:55:18 +08:00
Родитель 2b16f51241
Коммит 72cfd0cddb
2 изменённых файлов: 6 добавлений и 11 удалений

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

@ -631,7 +631,7 @@ protected:
int64_t mAltDataLength;
bool mForceMainDocumentChannel;
bool mIsTrackingResource;
Atomic<bool, ReleaseAcquire> mIsTrackingResource;
uint64_t mChannelId;

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

@ -1769,8 +1769,8 @@ HttpChannelChild::ProcessNotifyTrackingProtectionDisabled()
MOZ_ASSERT(OnSocketThread());
RefPtr<HttpChannelChild> self = this;
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
mainTarget->Dispatch(
nsCOMPtr<nsIEventTarget> neckoTarget = GetNeckoTarget();
neckoTarget->Dispatch(
NS_NewRunnableFunction(
"nsChannelClassifier::NotifyTrackingProtectionDisabled",
[self]() {
@ -1785,12 +1785,7 @@ HttpChannelChild::ProcessNotifyTrackingResource()
LOG(("HttpChannelChild::ProcessNotifyTrackingResource [this=%p]\n", this));
MOZ_ASSERT(OnSocketThread());
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
mainTarget->Dispatch(
NewRunnableMethod(
"HttpChannelChild::SetIsTrackingResource",
this, &HttpChannelChild::SetIsTrackingResource),
NS_DISPATCH_NORMAL);
SetIsTrackingResource();
}
void
@ -1815,8 +1810,8 @@ HttpChannelChild::ProcessSetClassifierMatchedInfo(const nsCString& aList,
LOG(("HttpChannelChild::ProcessSetClassifierMatchedInfo [this=%p]\n", this));
MOZ_ASSERT(OnSocketThread());
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
mainTarget->Dispatch(
nsCOMPtr<nsIEventTarget> neckoTarget = GetNeckoTarget();
neckoTarget->Dispatch(
NewRunnableMethod<const nsCString, const nsCString, const nsCString>
("HttpChannelChild::SetMatchedInfo",
this, &HttpChannelChild::SetMatchedInfo,