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

Unified Diff: webkit/quota/quota_database.h

Issue 7168019: Implement QM::GetOriginsModifiedSince for browser data deleter support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes + upgradeschema Created 9 years, 6 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: webkit/quota/quota_database.h
diff --git a/webkit/quota/quota_database.h b/webkit/quota/quota_database.h
index 981bb94a1bc575443a25a59a04b8cb212815f4bb..ad90712a958920306969aec50c2de76ff3c08e8f 100644
--- a/webkit/quota/quota_database.h
+++ b/webkit/quota/quota_database.h
@@ -33,6 +33,20 @@ class SpecialStoragePolicy;
// All the methods of this class must run on the DB thread.
class QuotaDatabase {
public:
+ // Structures used for CreateSchema.
+ // TODO(kinuko): probably they should be defined somewhere else as a common
michaeln 2011/07/01 00:17:39 Can these structs be moved to the private section?
kinuko 2011/07/04 07:43:52 Done.
+ // database types/utility.
+ struct TableSchema {
+ const char* table_name;
+ const char* columns;
+ };
+ struct IndexSchema {
+ const char* index_name;
+ const char* table_name;
+ const char* columns;
+ bool unique;
+ };
+
// If 'path' is empty, an in memory database will be used.
explicit QuotaDatabase(const FilePath& path);
~QuotaDatabase();
@@ -41,18 +55,23 @@ class QuotaDatabase {
bool GetHostQuota(const std::string& host, StorageType type, int64* quota);
bool SetHostQuota(const std::string& host, StorageType type, int64 quota);
+ bool DeleteHostQuota(const std::string& host, StorageType type);
- bool SetOriginLastAccessTime(const GURL& origin, StorageType type,
+ bool SetOriginLastAccessTime(const GURL& origin,
+ StorageType type,
base::Time last_access_time);
- // Register |origins| to Database with |used_count| = 0 and
- // specified |last_access_time|.
- bool RegisterOrigins(const std::set<GURL>& origins,
- StorageType type,
- base::Time last_access_time);
+ bool SetOriginLastModifiedTime(const GURL& origin,
+ StorageType type,
+ base::Time last_modified_time);
- bool DeleteHostQuota(const std::string& host, StorageType type);
- bool DeleteOriginLastAccessTime(const GURL& origin, StorageType type);
+ // Register initial |origins| info |type| to the database.
+ // This method is assumed to be called only after the installation or
+ // the database schema reset.
+ bool RegisterInitialOriginInfo(
+ const std::set<GURL>& origins, StorageType type);
+
+ bool DeleteOriginInfo(const GURL& origin, StorageType type);
bool GetGlobalQuota(StorageType type, int64* quota);
bool SetGlobalQuota(StorageType type, int64 quota);
@@ -66,6 +85,12 @@ class QuotaDatabase {
SpecialStoragePolicy* special_storage_policy,
GURL* origin);
+ // Populates |origins| with the ones that have been modified since
+ // the |modified_since|.
+ bool GetOriginsModifiedSince(StorageType type,
+ std::set<GURL>* origins,
+ base::Time modified_since);
+
// Returns false if SetOriginDatabaseBootstrapped has never
// been called before, which means existing origins may not have been
// registered.
@@ -81,18 +106,21 @@ class QuotaDatabase {
friend bool operator <(const QuotaTableEntry& lhs,
const QuotaTableEntry& rhs);
- struct LastAccessTimeTableEntry {
+ struct OriginInfoTableEntry {
GURL origin;
StorageType type;
int used_count;
base::Time last_access_time;
+ base::Time last_modified_time;
};
- friend bool operator <(const LastAccessTimeTableEntry& lhs,
- const LastAccessTimeTableEntry& rhs);
+ friend bool operator <(const OriginInfoTableEntry& lhs,
+ const OriginInfoTableEntry& rhs);
typedef base::Callback<bool (const QuotaTableEntry&)> QuotaTableCallback;
- typedef base::Callback<bool (const LastAccessTimeTableEntry&)>
- LastAccessTimeTableCallback;
+ typedef base::Callback<bool (const OriginInfoTableEntry&)>
+ OriginInfoTableCallback;
+
+ struct QuotaTableImporter;
// For long-running transactions support. We always keep a transaction open
// so that multiple transactions can be batched. They are flushed
@@ -107,13 +135,19 @@ class QuotaDatabase {
bool LazyOpen(bool create_if_needed);
bool EnsureDatabaseVersion();
- bool CreateSchema();
bool ResetSchema();
+ bool UpgradeSchema(int current_version);
- // |callback| may return false to stop reading data
- bool DumpQuotaTable(QuotaTableCallback* callback);
- bool DumpLastAccessTimeTable(LastAccessTimeTableCallback* callback);
+ static bool CreateSchema(
+ sql::Connection* database,
+ sql::MetaTable* meta_table,
+ int schema_version, int compatible_version,
+ const TableSchema* tables, size_t tables_size,
+ const IndexSchema* indexes, size_t indexes_size);
+ // |callback| may return false to stop reading data.
+ bool DumpQuotaTable(QuotaTableCallback* callback);
+ bool DumpOriginInfoTable(OriginInfoTableCallback* callback);
FilePath db_file_path_;

Powered by Google App Engine
This is Rietveld 408576698