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

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

Issue 2123813002: Report Precache.TimeSinceLastPrecache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Raj's comments Created 4 years, 5 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_database.h
diff --git a/components/precache/core/precache_database.h b/components/precache/core/precache_database.h
index aaea1ca9bbc005fec56820e787c0038a8b80df3e..8ff0d6a6d1e55174385014e474719760d82e82de 100644
--- a/components/precache/core/precache_database.h
+++ b/components/precache/core/precache_database.h
@@ -58,6 +58,10 @@ class PrecacheDatabase {
// Delete all history entries from the database.
void ClearHistory();
+ // Setter and getter for the last precache timestamp.
+ void SetLastPrecacheTimestamp(const base::Time& time);
+ base::Time GetLastPrecacheTimestamp();
+
// Report precache-related metrics in response to a URL being fetched, where
// the fetch was motivated by precaching.
void RecordURLPrefetch(const GURL& url,
@@ -109,6 +113,9 @@ class PrecacheDatabase {
// posted.
void MaybePostFlush();
+ // Records the time since the last precache.
+ void RecordTimeSinceLastPrecache(const base::Time& fetch_time);
+
std::unique_ptr<sql::Connection> db_;
// Table that keeps track of URLs that are in the cache because of precaching,
@@ -135,6 +142,11 @@ class PrecacheDatabase {
// or destructor are called on the same thread.
base::ThreadChecker thread_checker_;
+ // Time of the last precache. This is a cached copy of
+ // precache_session_table_.GetLastPrecacheTimestamp.
+ base::Time last_precache_timestamp_;
+
+ // This must be the last member of this class.
base::WeakPtrFactory<PrecacheDatabase> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase);

Powered by Google App Engine
This is Rietveld 408576698