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

Unified Diff: chrome/browser/webdata/web_database_table.h

Issue 12543034: Move creation of the various WebDatabaseTable types out of WebDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows release builds (COMDAT folding combined static functions being used for keys. Created 7 years, 9 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
« no previous file with comments | « chrome/browser/webdata/web_database_service.cc ('k') | chrome/browser/webdata/web_database_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_database_table.h
diff --git a/chrome/browser/webdata/web_database_table.h b/chrome/browser/webdata/web_database_table.h
index 76226959be4468c29e2c00f46b5fd54654cadf88..881d5e74fb07c251563da602c111ffe898f9cc62 100644
--- a/chrome/browser/webdata/web_database_table.h
+++ b/chrome/browser/webdata/web_database_table.h
@@ -16,11 +16,23 @@ class MetaTable;
// Each table should subclass this, adding type-specific methods as needed.
class WebDatabaseTable {
public:
- WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table);
+ // To look up a WebDatabaseTable of a certain type from WebDatabase,
+ // we use a void* key, so that we can simply use the address of one
+ // of the type's statics.
+ typedef void* TypeKey;
+
+ // The object is not ready for use until Init() has been called.
+ WebDatabaseTable();
virtual ~WebDatabaseTable();
+ // Retrieves the TypeKey for the concrete subtype.
+ virtual TypeKey GetTypeKey() const = 0;
+
// Attempts to initialize the table and returns true if successful.
- virtual bool Init() = 0;
+ //
+ // The base class stores the members passed and always return true;
+ // subclasses may perform other initialization as needed.
+ virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table);
// In order to encourage developers to think about sync when adding or
// or altering new tables, this method must be implemented. Please get in
@@ -43,6 +55,10 @@ class WebDatabaseTable {
bool* update_compatible_version) = 0;
protected:
+ // Non-owning. These are owned by WebDatabase, valid as long as that
+ // class exists. Since lifetime of WebDatabaseTable objects slightly
+ // exceeds that of WebDatabase, they should not be used in
+ // ~WebDatabaseTable.
sql::Connection* db_;
sql::MetaTable* meta_table_;
« no previous file with comments | « chrome/browser/webdata/web_database_service.cc ('k') | chrome/browser/webdata/web_database_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698