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

Unified Diff: components/history/core/browser/in_memory_database.cc

Issue 2954593002: History init: add metrics and skip migration. (Closed)
Patch Set: Explicit enum values Created 3 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: components/history/core/browser/in_memory_database.cc
diff --git a/components/history/core/browser/in_memory_database.cc b/components/history/core/browser/in_memory_database.cc
index e06941f3ceb5a2408d5007912adb77a8c0cf29d0..3ae5f679041582440be38c36bd25d893649cfcbb 100644
--- a/components/history/core/browser/in_memory_database.cc
+++ b/components/history/core/browser/in_memory_database.cc
@@ -79,8 +79,23 @@ bool InMemoryDatabase::InitFromDisk(const base::FilePath& history_name) {
// Copy URL data to memory.
base::TimeTicks begin_load = base::TimeTicks::Now();
+
+ // Need to explicitly specify the column names here since databases on disk
+ // may or may not have a favicon_id column, but the in-memory one will never
+ // have it. Therefore, the columns aren't guaranteed to match.
+ //
+ // TODO(https://crbug.com/736136) Once we can guarantee that the favicon_id
+ // column doesn't exist with migration code, this can be replaced with the
+ // simpler:
+ // "INSERT INTO urls SELECT * FROM history.urls WHERE typed_count > 0"
+ // which does not require us to keep the list of columns in sync. However,
+ // we may still want to keep the explicit columns as a safety measure.
if (!db_.Execute(
- "INSERT INTO urls SELECT * FROM history.urls WHERE typed_count > 0")) {
+ "INSERT INTO urls "
+ "(id, url, title, visit_count, typed_count, last_visit_time, hidden) "
+ "SELECT "
+ "id, url, title, visit_count, typed_count, last_visit_time, hidden "
+ "FROM history.urls WHERE typed_count > 0")) {
// Unable to get data from the history database. This is OK, the file may
// just not exist yet.
}
« no previous file with comments | « components/history/core/browser/history_database.cc ('k') | components/history/core/browser/url_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698