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

Unified Diff: components/precache/core/precache_url_table.h

Issue 2364873004: Add Precache.CacheStatus.NonPrefetch.FromPrecache. (Closed)
Patch Set: Add const. Created 4 years, 2 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: components/precache/core/precache_url_table.h
diff --git a/components/precache/core/precache_url_table.h b/components/precache/core/precache_url_table.h
index 921de6cfabad8bcc7eabb61e86b59fe61b07c988..4ddbb61e13a9d9ea2d7b1019965b7044586cf297 100644
--- a/components/precache/core/precache_url_table.h
+++ b/components/precache/core/precache_url_table.h
@@ -20,6 +20,23 @@ class Connection;
namespace precache {
+// Information about a given URL with respect to the PrecacheURLTable.
+struct PrecacheURLInfo {
+ // The url has been prefetched in the past 60 days. (This number comes from
+ // kPrecacheHistoryExpiryPeriodDays in precache_database.cc.)
+ bool was_precached;
+
+ // True if the cache entry is the one fetched by PrecacheFetcher. False if a
+ // new network fetch overwrote the cache entry since the prefetch.
+ bool is_precached;
+
+ // The prefetched copy of the URL was used in browsing (i.e. while
+ // is_precached was true).
+ bool was_used;
+
+ bool operator==(const PrecacheURLInfo& other) const;
+};
+
// Interface for database table that keeps track of the URLs that have been
// precached but not used. This table is used to count how many bytes were saved
// by precached resources.
@@ -44,11 +61,8 @@ class PrecacheURLTable {
bool is_precached,
const base::Time& precache_time);
- // Returns true if the url is precached.
- bool IsURLPrecached(const GURL& url);
-
- // Returns true if the url is precached, and was not used before.
- bool IsURLPrecachedAndUnused(const GURL& url);
+ // Returns information about the URL's status with respect to prefetching.
+ PrecacheURLInfo GetURLInfo(const GURL& url);
// Sets the precached URL as used.
void SetPrecachedURLAsUsed(const GURL& url);
« no previous file with comments | « components/precache/core/precache_database_unittest.cc ('k') | components/precache/core/precache_url_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698