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

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

Issue 2586813004: Report downloaded resources at most once (Closed)
Patch Set: Fix race condition in PrecacheFetcherTest due to MaybePost 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..ff102caccf94744679daf28dbde467e5b7b7a607 100644
--- a/components/precache/core/precache_url_table.h
+++ b/components/precache/core/precache_url_table.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/time/time.h"
+#include "sql/statement.h"
twifkak 2016/12/20 01:42:00 If this is for sql::Statement, just fwd declare: h
jamartin 2016/12/20 21:09:34 Done.
#include "url/gurl.h"
namespace sql {
@@ -59,6 +60,7 @@ class PrecacheURLTable {
void AddURL(const GURL& url,
int64_t referrer_host_id,
bool is_precached,
+ bool was_cached,
const base::Time& precache_time);
// Returns information about the URL's status with respect to prefetching.
@@ -71,10 +73,10 @@ class PrecacheURLTable {
void SetURLAsNotPrecached(const GURL& url);
// Populates the used and unused resource URLs for the referrer host with id
twifkak 2016/12/20 01:42:00 s/unused/downloaded
jamartin 2016/12/20 21:09:34 Done.
- // |referrer_host_id|.
+ // |referrer_host_id|. It will also clear the reported downloaded_urls.
void GetURLListForReferrerHost(int64_t referrer_host_id,
std::vector<GURL>* used_urls,
- std::vector<GURL>* unused_urls);
+ std::vector<GURL>* downloaded_urls);
// Clears all URL entries for the referrer host |referrer_host_id|.
void ClearAllForReferrerHost(int64_t referrer_host_id);
@@ -91,6 +93,14 @@ class PrecacheURLTable {
private:
bool CreateTableIfNonExistent();
+ bool SetIsDownloadReported(int64_t referrer_host_id, const GURL& url);
+
+ bool BindStatementAndRun(const GURL& url,
+ int64_t referrer_host_id,
+ bool is_precached,
+ const base::Time& precache_time,
+ sql::Statement* statement);
+
// Non-owned pointer.
sql::Connection* db_;

Powered by Google App Engine
This is Rietveld 408576698