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

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

Issue 2586813004: Report downloaded resources at most once (Closed)
Patch Set: Improved tests Created 4 years 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 4ddbb61e13a9d9ea2d7b1019965b7044586cf297..4f4effd363193fe62f5af5401805de2e2fec9549 100644
--- a/components/precache/core/precache_url_table.h
+++ b/components/precache/core/precache_url_table.h
@@ -34,6 +34,9 @@ struct PrecacheURLInfo {
// is_precached was true).
bool was_used;
+ // It was already reported that this resources was downloaded.
+ bool is_download_reported;
+
bool operator==(const PrecacheURLInfo& other) const;
};
@@ -55,11 +58,14 @@ class PrecacheURLTable {
// Adds an URL to the table, |referrer_host_id| is the id of the referrer host
// in PrecacheReferrerHostTable, |is_precached| indicates if the URL is
- // precached, |time| is the timestamp. Replaces the row if one already exists.
+ // precached, |time| is the timestamp, |is_download_reported| indicates if
+ // this the download of this URL was already reported. Replaces the row if one
+ // already exists.
void AddURL(const GURL& url,
int64_t referrer_host_id,
bool is_precached,
- const base::Time& precache_time);
+ const base::Time& precache_time,
+ bool is_download_reported);
// Returns information about the URL's status with respect to prefetching.
PrecacheURLInfo GetURLInfo(const GURL& url);
@@ -70,11 +76,14 @@ class PrecacheURLTable {
// Set the previously precached URL as not precached, during user browsing.
void SetURLAsNotPrecached(const GURL& url);
- // Populates the used and unused resource URLs for the referrer host with id
- // |referrer_host_id|.
+ // Populates the used and downloaded resource URLs for the referrer host with
+ // id |referrer_host_id|.
void GetURLListForReferrerHost(int64_t referrer_host_id,
std::vector<GURL>* used_urls,
- std::vector<GURL>* unused_urls);
+ std::vector<GURL>* downloaded_urls);
+
+ // Sets all the URLs of the given referrer_host_id as is_download_reported.
+ void SetDownloadReported(int64_t referrer_host_id);
// Clears all URL entries for the referrer host |referrer_host_id|.
void ClearAllForReferrerHost(int64_t referrer_host_id);
« no previous file with comments | « components/precache/core/precache_fetcher_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