Chromium Code Reviews| 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) { |