Bug 1425458 - Resource timing entries Workers - part 9 - Fixing a compilation issue, r=me CLOSED TREE
☠☠ backed out by e0c276b06c0d ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 24 Jan 2018 18:19:12 +0100
changeset 400594 a29e9dbb8c42f927889b8f755e8c5e137920cdb1
parent 400593 b96d58fd945ced9050f9b4602b9dfdf857d0954c
child 400595 8f3552d6162728fffd709a25d8600acb06a69427
push id99192
push useramarchesini@mozilla.com
push dateWed, 24 Jan 2018 17:19:48 +0000
treeherdermozilla-inbound@a29e9dbb8c42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1425458
milestone60.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 1425458 - Resource timing entries Workers - part 9 - Fixing a compilation issue, r=me CLOSED TREE
dom/performance/PerformanceMainThread.cpp
dom/performance/PerformanceStorageWorker.h
dom/performance/PerformanceTiming.cpp
dom/performance/PerformanceTiming.h
--- a/dom/performance/PerformanceMainThread.cpp
+++ b/dom/performance/PerformanceMainThread.cpp
@@ -280,19 +280,24 @@ PerformanceMainThread::CreationTime() co
 {
   return GetDOMTiming()->GetNavigationStart();
 }
 
 void
 PerformanceMainThread::EnsureDocEntry()
 {
   if (!mDocEntry && nsContentUtils::IsPerformanceNavigationTimingEnabled()) {
-    nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
     UniquePtr<PerformanceTimingData> timing(
       new PerformanceTimingData(mChannel, nullptr, 0));
+
+    nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
+    if (httpChannel) {
+      timing->SetPropertiesFromHttpChannel(httpChannel);
+    }
+
     mDocEntry = new PerformanceNavigationTiming(Move(timing), this);
   }
 }
 
 
 void
 PerformanceMainThread::GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval)
 {
--- a/dom/performance/PerformanceStorageWorker.h
+++ b/dom/performance/PerformanceStorageWorker.h
@@ -32,17 +32,17 @@ public:
   void ShutdownOnWorker();
 
   void AddEntry(nsIHttpChannel* aChannel,
                 nsITimedChannel* aTimedChannel) override;
 
   void AddEntryOnWorker(UniquePtr<PerformanceProxyData>&& aData);
 
 private:
-  PerformanceStorageWorker(workers::WorkerPrivate* aWorkerPrivate);
+  explicit PerformanceStorageWorker(workers::WorkerPrivate* aWorkerPrivate);
   ~PerformanceStorageWorker();
 
   Mutex mMutex;
 
   // Protected by mutex.
   // This raw pointer is nullified when the WorkerHolder communicates the
   // shutting down of the worker thread.
   workers::WorkerPrivate* mWorkerPrivate;
--- a/dom/performance/PerformanceTiming.cpp
+++ b/dom/performance/PerformanceTiming.cpp
@@ -202,26 +202,34 @@ PerformanceTimingData::PerformanceTiming
   // for resource timing, which can include document loads, both toplevel and
   // in subframes, and resources linked from a document.
   if (aHttpChannel) {
     mTimingAllowed = CheckAllowedOrigin(aHttpChannel, aChannel);
     bool redirectsPassCheck = false;
     aChannel->GetAllRedirectsPassTimingAllowCheck(&redirectsPassCheck);
     mReportCrossOriginRedirect = mTimingAllowed && redirectsPassCheck;
 
-    nsAutoCString protocol;
-    Unused << aHttpChannel->GetProtocolVersion(protocol);
-    mNextHopProtocol = NS_ConvertUTF8toUTF16(protocol);
+    SetPropertiesFromHttpChannel(aHttpChannel);
+  }
+}
+
+void
+PerformanceTimingData::SetPropertiesFromHttpChannel(nsIHttpChannel* aHttpChannel)
+{
+  MOZ_ASSERT(aHttpChannel);
 
-    Unused << aHttpChannel->GetEncodedBodySize(&mEncodedBodySize);
-    Unused << aHttpChannel->GetTransferSize(&mTransferSize);
-    Unused << aHttpChannel->GetDecodedBodySize(&mDecodedBodySize);
-    if (mDecodedBodySize == 0) {
-      mDecodedBodySize = mEncodedBodySize;
-    }
+  nsAutoCString protocol;
+  Unused << aHttpChannel->GetProtocolVersion(protocol);
+  mNextHopProtocol = NS_ConvertUTF8toUTF16(protocol);
+
+  Unused << aHttpChannel->GetEncodedBodySize(&mEncodedBodySize);
+  Unused << aHttpChannel->GetTransferSize(&mTransferSize);
+  Unused << aHttpChannel->GetDecodedBodySize(&mDecodedBodySize);
+  if (mDecodedBodySize == 0) {
+    mDecodedBodySize = mEncodedBodySize;
   }
 }
 
 PerformanceTiming::~PerformanceTiming()
 {
 }
 
 DOMHighResTimeStamp
--- a/dom/performance/PerformanceTiming.h
+++ b/dom/performance/PerformanceTiming.h
@@ -34,16 +34,19 @@ public:
          DOMHighResTimeStamp aZeroTime,
          nsAString& aInitiatorType,
          nsAString& aEntryName);
 
   PerformanceTimingData(nsITimedChannel* aChannel,
                         nsIHttpChannel* aHttpChannel,
                         DOMHighResTimeStamp aZeroTime);
 
+  void
+  SetPropertiesFromHttpChannel(nsIHttpChannel* aHttpChannel);
+
   bool IsInitialized() const
   {
     return mInitialized;
   }
 
   const nsString& NextHopProtocol() const
   {
     return mNextHopProtocol;