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

Unified Diff: chrome/browser/net/predictor.h

Issue 15675002: Add the UMA recording recall of URLRequests preconnected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing files 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
« no previous file with comments | « chrome/browser/net/connect_interceptor.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/predictor.h
diff --git a/chrome/browser/net/predictor.h b/chrome/browser/net/predictor.h
index 8161a3616beb5eebdbc4427cf1e978ccaa0b306d..b56a62bdf913840cb937999a953b3be0569b9036 100644
--- a/chrome/browser/net/predictor.h
+++ b/chrome/browser/net/predictor.h
@@ -29,6 +29,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/net/referrer.h"
+#include "chrome/browser/net/timed_cache.h"
#include "chrome/browser/net/url_info.h"
#include "chrome/common/net/predictor_common.h"
#include "net/base/host_port_pair.h"
@@ -91,6 +92,13 @@ class Predictor {
// avoidance will kick in and all speculations in the queue will be discarded.
static const int kMaxSpeculativeResolveQueueDelayMs;
+ // We don't bother learning to preconnect via a GET if the original URL
+ // navigation was so long ago, that a preconnection would have been dropped
+ // anyway. We believe most servers will drop the connection in 10 seconds, so
+ // we currently estimate this time-till-drop at 10 seconds.
+ // TODO(jar): We should do a persistent field trial to validate/optimize this.
+ static const int kMaxUnusedSocketLifetimeSecondsWithoutAGet;
+
// |max_concurrent| specifies how many concurrent (parallel) prefetches will
// be performed. Host lookups will be issued through |host_resolver|.
explicit Predictor(bool preconnect_enabled);
@@ -220,6 +228,18 @@ class Predictor {
void EnablePredictorOnIOThread(bool enable);
+ // May be called from either the IO or UI thread and will PostTask
+ // to the IO thread if necessary.
+ void PreconnectUrl(const GURL& url, const GURL& first_party_for_cookies,
+ UrlInfo::ResolutionMotivation motivation, int count);
+
+ void PreconnectUrlOnIOThread(const GURL& url,
+ const GURL& first_party_for_cookies,
+ UrlInfo::ResolutionMotivation motivation,
+ int count);
+
+ void RecordPreconnectNavigationStats(const GURL& url);
+
// ------------- End IO thread methods.
// The following methods may be called on either the IO or UI threads.
@@ -489,6 +509,8 @@ class Predictor {
// The time when the last preconnection was requested to a search service.
base::TimeTicks last_omnibox_preconnect_;
+ TimedCache recent_preconnects_;
+
// For each URL that we might navigate to (that we've "learned about")
// we have a Referrer list. Each Referrer list has all hostnames we might
// need to pre-resolve or pre-connect to when there is a navigation to the
« no previous file with comments | « chrome/browser/net/connect_interceptor.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698