summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/predictor.cc
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 07:10:24 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 07:10:24 +0000
commit9008c86f2a99b112300ef7833d35f2ff1696a88a (patch)
tree9ba3e6a50b61f76612f3db42b18e5f10ae6f364a /chrome/browser/net/predictor.cc
parent6a054ffaae82f5ac8d6b876d7c85f0d87d892e42 (diff)
downloadchromium_src-9008c86f2a99b112300ef7833d35f2ff1696a88a.zip
chromium_src-9008c86f2a99b112300ef7833d35f2ff1696a88a.tar.gz
chromium_src-9008c86f2a99b112300ef7833d35f2ff1696a88a.tar.bz2
Reland 54771 (and 54795) To enable TCP Preconnection by default
I pulled out the code to update the socket connectivity stats. I added defensive code which should preclude the crash that was reported on the stability bot. I added a second call to update the stats from ~ClientSocketHandle to ensure that we updated the related ClientSocket when we are torn down. As noted in the original checkin: Enable speculative preconnection by default Added histogram to track preconnection utilization (vs waste). BUG=42694 r=mbelshe Review URL: http://codereview.chromium.org/3050040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/predictor.cc')
-rw-r--r--chrome/browser/net/predictor.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
index eb4992c..5c1b518 100644
--- a/chrome/browser/net/predictor.cc
+++ b/chrome/browser/net/predictor.cc
@@ -149,6 +149,20 @@ void Predictor::PredictFrameSubresources(const GURL& url) {
Referrers::iterator it = referrers_.find(url);
if (referrers_.end() == it)
return;
+ ChromeThread::PostTask(
+ ChromeThread::IO,
+ FROM_HERE,
+ NewRunnableMethod(this,
+ &Predictor::PrepareFrameSubresources, url));
+}
+
+void Predictor::PrepareFrameSubresources(const GURL& url) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ DCHECK(url.GetWithEmptyPath() == url);
+ Referrers::iterator it = referrers_.find(url);
+ if (referrers_.end() == it)
+ return;
+
Referrer* referrer = &(it->second);
referrer->IncrementUseCount();
const UrlInfo::ResolutionMotivation motivation =