Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2952)

Unified Diff: chrome/browser/net/connect_interceptor.cc

Issue 15675002: Add the UMA recording recall of URLRequests preconnected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style fix Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/connect_interceptor.cc
diff --git a/chrome/browser/net/connect_interceptor.cc b/chrome/browser/net/connect_interceptor.cc
index e2bf67b57e10e8499e4cb055accf32481e7e0a1f..2250b9938eaa175f304be57fb9c31fcebb5c5752 100644
--- a/chrome/browser/net/connect_interceptor.cc
+++ b/chrome/browser/net/connect_interceptor.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/net/connect_interceptor.h"
+#include "base/metrics/histogram.h"
#include "chrome/browser/net/predictor.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request.h"
@@ -20,6 +21,8 @@ static const int kMaxUnusedSocketLifetimeSecondsWithoutAGet = 10;
ConnectInterceptor::ConnectInterceptor(Predictor* predictor)
: timed_cache_(base::TimeDelta::FromSeconds(
kMaxUnusedSocketLifetimeSecondsWithoutAGet)),
+ recent_preconnects_(base::TimeDelta::FromSeconds(
+ kMaxUnusedSocketLifetimeSecondsWithoutAGet)),
predictor_(predictor) {
DCHECK(predictor);
}
@@ -77,6 +80,9 @@ void ConnectInterceptor::WitnessURLRequest(net::URLRequest* request) const {
}
}
timed_cache_.SetRecentlySeen(request_scheme_host);
+ UMA_HISTOGRAM_BOOLEAN(
+ "Net.PreconnectedNavigation",
+ recent_preconnects_.WasRecentlySeen(request_scheme_host));
// Subresources for main frames usually get predicted when we detected the
// main frame request - way back in RenderViewHost::Navigate. So only handle
@@ -87,6 +93,11 @@ void ConnectInterceptor::WitnessURLRequest(net::URLRequest* request) const {
return;
}
+void ConnectInterceptor::WitnessPreconnect(const GURL& url) {
+ GURL request_scheme_host(Predictor::CanonicalizeUrl(url));
+ recent_preconnects_.SetRecentlySeen(request_scheme_host);
mmenke 2013/05/22 17:58:43 I think this could actually all be done in the pre
kouhei (in TOK) 2013/05/23 07:31:13 I tried moving the logic to Predictor. TimedCache
+}
+
ConnectInterceptor::TimedCache::TimedCache(const base::TimeDelta& max_duration)
: mru_cache_(UrlMruTimedCache::NO_AUTO_EVICT),
max_duration_(max_duration) {

Powered by Google App Engine
This is Rietveld 408576698