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

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

Issue 2335913002: Add daily quota for precache (Closed)
Patch Set: Addressed sclittle@ comments Created 4 years, 3 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_session_table.h
diff --git a/components/precache/core/precache_session_table.h b/components/precache/core/precache_session_table.h
index ce742b1bec3c977387967bc29f2050bff3af929e..4ddeda91ce81f9be6de7e9bbe5970da38700becb 100644
--- a/components/precache/core/precache_session_table.h
+++ b/components/precache/core/precache_session_table.h
@@ -5,17 +5,11 @@
#ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
#define COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
-#include <list>
-#include <map>
#include <memory>
#include "base/macros.h"
#include "base/time/time.h"
-#include "url/gurl.h"
-
-namespace base {
-class TimeTicks;
-}
+#include "components/precache/core/proto/quota.pb.h"
namespace sql {
class Connection;
@@ -26,11 +20,15 @@ namespace precache {
class PrecacheUnfinishedWork;
// Denotes the type of session information being stored.
-enum SessionDataType {
+enum class SessionDataType {
// Unfinished work to do sometime later.
UNFINISHED_WORK = 0,
+
// Timestamp of the last precache.
LAST_PRECACHE_TIMESTAMP = 1,
+
+ // Remaining quota limits.
+ QUOTA = 2,
};
class PrecacheSessionTable {
@@ -53,6 +51,10 @@ class PrecacheSessionTable {
void DeleteLastPrecacheTimestamp();
+ // Precache quota.
+ void SaveQuota(const PrecacheQuota& quota);
+ PrecacheQuota GetQuota();
+
// -- Unfinished work --
// Stores unfinished work.
@@ -68,6 +70,9 @@ class PrecacheSessionTable {
private:
bool CreateTableIfNonExistent();
+ void SetSessionDataType(SessionDataType id, const std::string& data);
+ std::string GetSessionDataType(SessionDataType id);
+
// Non-owned pointer.
sql::Connection* db_;

Powered by Google App Engine
This is Rietveld 408576698