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

Unified Diff: chrome/browser/net/connect_interceptor.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 | « no previous file | chrome/browser/net/connect_interceptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/connect_interceptor.h
diff --git a/chrome/browser/net/connect_interceptor.h b/chrome/browser/net/connect_interceptor.h
index 8cb83bf5e52a3e60283cd78d7700efd6037423e9..2caa8b804b06b92755f3bedf1f17acf76efb2365 100644
--- a/chrome/browser/net/connect_interceptor.h
+++ b/chrome/browser/net/connect_interceptor.h
@@ -5,10 +5,9 @@
#ifndef CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
#define CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
-#include "base/containers/mru_cache.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
-#include "base/time.h"
+#include "chrome/browser/net/timed_cache.h"
class GURL;
@@ -38,35 +37,6 @@ class ConnectInterceptor {
FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheRecall);
FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheEviction);
- // Define a LRU cache that recalls all navigations within the last N seconds.
- // When we learn about subresources to possibly preconnect to, it would be a
- // waste to preconnect when the original navigation was too long ago. Any
- // connected, but unused TCP/IP connection, will generally be reset by the
- // server if it is not used quickly (i.e., GET or POST is sent).
- class TimedCache {
- public:
- explicit TimedCache(const base::TimeDelta& max_duration);
- ~TimedCache();
-
- // Evicts any entries that have been in the FIFO "too long," and then checks
- // to see if the given url is (still) in the FIFO cache.
- bool WasRecentlySeen(const GURL& url);
-
- // Adds the given url to the cache, where it will remain for max_duration_.
- void SetRecentlySeen(const GURL& url);
-
- private:
- // Our cache will be keyed on a URL (actually, just a scheme/host/port).
- // We will always track the time it was last added to the FIFO cache by
- // remembering a TimeTicks value.
- typedef base::MRUCache<GURL, base::TimeTicks> UrlMruTimedCache;
- UrlMruTimedCache mru_cache_;
-
- // The longest time an entry can persist in the cache, and still be found.
- const base::TimeDelta max_duration_;
-
- DISALLOW_COPY_AND_ASSIGN(TimedCache);
- };
TimedCache timed_cache_;
Predictor* const predictor_;
« no previous file with comments | « no previous file | chrome/browser/net/connect_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698