Bug 881804 (part 5) - Plumb image loader into predictive network actions. r=seth
authorNicholas Hurley <hurley@todesschaf.org>
Fri, 25 Oct 2013 14:56:58 -0700
changeset 166121 dbad5acdc1c732cfa64d935996fa6199eb990478
parent 166120 4967a9b78382179d4d02dbf6b5374c0f2363a5a7
child 166122 17dbbb898b80c601b46d45988c87773b8b69c8a6
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs881804
milestone27.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 881804 (part 5) - Plumb image loader into predictive network actions. r=seth
image/src/imgLoader.cpp
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -24,16 +24,17 @@
 #include "nsICachingChannel.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIProgressEventSink.h"
 #include "nsIChannelEventSink.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsIFileURL.h"
 #include "nsCRT.h"
 #include "nsIDocument.h"
+#include "nsINetworkSeer.h"
 
 #include "nsIApplicationCache.h"
 #include "nsIApplicationCacheContainer.h"
 
 #include "nsIMemoryReporter.h"
 #include "Image.h"
 #include "DiscardTracker.h"
 
@@ -1233,16 +1234,19 @@ bool imgLoader::ValidateRequestWithNewCh
     // In the mean time, we must defer notifications because we are added to
     // the imgRequest's proxy list, and we can get extra notifications
     // resulting from methods such as RequestDecode(). See bug 579122.
     proxy->SetNotificationsDeferred(true);
 
     // Add the proxy without notifying
     hvc->AddProxy(proxy);
 
+    mozilla::net::SeerLearn(aURI, aInitialDocumentURI,
+        nsINetworkSeer::LEARN_LOAD_SUBRESOURCE, aLoadGroup);
+
     rv = newChannel->AsyncOpen(listener, nullptr);
     if (NS_SUCCEEDED(rv))
       NS_ADDREF(*aProxyRequest = req.get());
 
     return NS_SUCCEEDED(rv);
   }
 }
 
@@ -1730,16 +1734,19 @@ nsresult imgLoader::LoadImage(nsIURI *aU
       }
 
       listener = corsproxy;
     }
 
     PR_LOG(GetImgLog(), PR_LOG_DEBUG,
            ("[this=%p] imgLoader::LoadImage -- Calling channel->AsyncOpen()\n", this));
 
+    mozilla::net::SeerLearn(aURI, aInitialDocumentURI,
+        nsINetworkSeer::LEARN_LOAD_SUBRESOURCE, aLoadGroup);
+
     nsresult openRes = newChannel->AsyncOpen(listener, nullptr);
 
     if (NS_FAILED(openRes)) {
       PR_LOG(GetImgLog(), PR_LOG_DEBUG,
              ("[this=%p] imgLoader::LoadImage -- AsyncOpen() failed: 0x%x\n",
               this, openRes));
       request->CancelAndAbort(openRes);
       return openRes;