Bug 1384294 - replace GetMainThreadEventTarget with GetNeckoTarget in HttpChannelChild. r=mayhemer
authorShih-Chiang Chien <schien@mozilla.com>
Wed, 26 Jul 2017 15:55:18 +0800
changeset 422738 d42bfe2b2e63992b5a201e15f6cb3de8cc11a112
parent 422737 fda73b7884dfaabd74069cd31150fa286a3bb333
child 422739 9b266be297891f2ee6425070e2ac336722c5b865
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1384294
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
netwerk/protocol/http/HttpBaseChannel.h
netwerk/protocol/http/HttpChannelChild.cpp
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -626,17 +626,17 @@ protected:
 
   // Holds the name of the preferred alt-data type.
   nsCString mPreferredCachedAltDataType;
   // Holds the name of the alternative data type the channel returned.
   nsCString mAvailableCachedAltDataType;
   int64_t   mAltDataLength;
 
   bool mForceMainDocumentChannel;
-  bool mIsTrackingResource;
+  Atomic<bool, ReleaseAcquire> mIsTrackingResource;
 
   uint64_t mChannelId;
 
   // If this channel was created as the result of a redirect, then this value
   // will reflect the redirect flags passed to the SetupReplacementChannel()
   // method.
   uint32_t mLastRedirectFlags;
 
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1764,38 +1764,33 @@ HttpChannelChild::ProcessFlushedForDiver
 
 void
 HttpChannelChild::ProcessNotifyTrackingProtectionDisabled()
 {
   LOG(("HttpChannelChild::ProcessNotifyTrackingProtectionDisabled [this=%p]\n", this));
   MOZ_ASSERT(OnSocketThread());
 
   RefPtr<HttpChannelChild> self = this;
-  nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
-  mainTarget->Dispatch(
+  nsCOMPtr<nsIEventTarget> neckoTarget = GetNeckoTarget();
+  neckoTarget->Dispatch(
     NS_NewRunnableFunction(
       "nsChannelClassifier::NotifyTrackingProtectionDisabled",
       [self]() {
         nsChannelClassifier::NotifyTrackingProtectionDisabled(self);
       }),
     NS_DISPATCH_NORMAL);
 }
 
 void
 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
 HttpChannelChild::FlushedForDiversion()
 {
   LOG(("HttpChannelChild::FlushedForDiversion [this=%p]\n", this));
   MOZ_RELEASE_ASSERT(mDivertingToParent);
 
@@ -1810,18 +1805,18 @@ HttpChannelChild::FlushedForDiversion()
 void
 HttpChannelChild::ProcessSetClassifierMatchedInfo(const nsCString& aList,
                                                   const nsCString& aProvider,
                                                   const nsCString& aPrefix)
 {
   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,
        aList, aProvider, aPrefix),
     NS_DISPATCH_NORMAL);
 }
 
 void