summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/history/history_database.cc17
-rw-r--r--chrome/browser/history/history_database.h6
-rw-r--r--chrome/common/net/cookie_monster_sqlite.cc15
3 files changed, 3 insertions, 35 deletions
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc
index db63a34..7b198fc 100644
--- a/chrome/browser/history/history_database.cc
+++ b/chrome/browser/history/history_database.cc
@@ -57,8 +57,8 @@ InitStatus HistoryDatabase::Init(const FilePath& history_name,
// Make sure the statement cache is properly initialized.
statement_cache_->set_db(db_);
- // Prime the cache. See the header file's documentation for this function.
- PrimeCache();
+ // Prime the cache.
+ MetaTableHelper::PrimeCache(std::string(), db_);
// Create the tables and indices.
// NOTE: If you add something here, also add it to
@@ -88,19 +88,6 @@ void HistoryDatabase::BeginExclusiveMode() {
sqlite3_exec(db_, "PRAGMA locking_mode=EXCLUSIVE", NULL, NULL, NULL);
}
-void HistoryDatabase::PrimeCache() {
- // A statement must be open for the preload command to work. If the meta
- // table can't be read, it probably means this is a new database and there
- // is nothing to preload (so it's OK we do nothing).
- SQLStatement dummy;
- if (dummy.prepare(db_, "SELECT * from meta") != SQLITE_OK)
- return;
- if (dummy.step() != SQLITE_ROW)
- return;
-
- sqlite3Preload(db_);
-}
-
// static
int HistoryDatabase::GetCurrentVersion() {
return kCurrentVersionNumber;
diff --git a/chrome/browser/history/history_database.h b/chrome/browser/history/history_database.h
index 5791c07..61a27d7 100644
--- a/chrome/browser/history/history_database.h
+++ b/chrome/browser/history/history_database.h
@@ -129,12 +129,6 @@ class HistoryDatabase : public DownloadDatabase,
virtual sqlite3* GetDB();
virtual SqliteStatementCache& GetStatementCache();
- // Primes the sqlite cache on startup by filling it with the file in sequence
- // until there is no more data or the cache is full. Since this is one
- // contiguous read operation, it is much faster than letting the pages come
- // in on-demand (which causes lots of seeks).
- void PrimeCache();
-
// Migration -----------------------------------------------------------------
// Makes sure the version is up-to-date, updating if necessary. If the
diff --git a/chrome/common/net/cookie_monster_sqlite.cc b/chrome/common/net/cookie_monster_sqlite.cc
index 0cb49ca..2b42bcc 100644
--- a/chrome/common/net/cookie_monster_sqlite.cc
+++ b/chrome/common/net/cookie_monster_sqlite.cc
@@ -303,19 +303,6 @@ bool InitTable(sqlite3* db) {
return true;
}
-void PrimeCache(sqlite3* db) {
- // A statement must be open for the preload command to work. If the meta
- // table can't be read, it probably means this is a new database and there
- // is nothing to preload (so it's OK we do nothing).
- SQLStatement dummy;
- if (dummy.prepare(db, "SELECT * from meta") != SQLITE_OK)
- return;
- if (dummy.step() != SQLITE_ROW)
- return;
-
- sqlite3Preload(db);
-}
-
} // namespace
bool SQLitePersistentCookieStore::Load(
@@ -333,7 +320,7 @@ bool SQLitePersistentCookieStore::Load(
return false;
}
- PrimeCache(db);
+ MetaTableHelper::PrimeCache(std::string(), db);
// Slurp all the cookies into the out-vector.
SQLStatement smt;