OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/history/history_database.h" | 5 #include "chrome/browser/history/history_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include "app/sql/transaction.h" | 10 #include "app/sql/transaction.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (!db_.Open(history_name)) | 90 if (!db_.Open(history_name)) |
91 return sql::INIT_FAILURE; | 91 return sql::INIT_FAILURE; |
92 | 92 |
93 // Wrap the rest of init in a tranaction. This will prevent the database from | 93 // Wrap the rest of init in a tranaction. This will prevent the database from |
94 // getting corrupted if we crash in the middle of initialization or migration. | 94 // getting corrupted if we crash in the middle of initialization or migration. |
95 sql::Transaction committer(&db_); | 95 sql::Transaction committer(&db_); |
96 if (!committer.Begin()) | 96 if (!committer.Begin()) |
97 return sql::INIT_FAILURE; | 97 return sql::INIT_FAILURE; |
98 | 98 |
99 #if defined(OS_MACOSX) | 99 #if defined(OS_MACOSX) |
100 // Exclude the history file and its journal from backups. | 100 // Exclude the history file from backups. |
101 base::mac::SetFileBackupExclusion(history_name, true); | 101 base::mac::SetFileBackupExclusion(history_name); |
102 FilePath::StringType history_name_string(history_name.value()); | |
103 history_name_string += "-journal"; | |
104 FilePath history_journal_name(history_name_string); | |
105 base::mac::SetFileBackupExclusion(history_journal_name, true); | |
106 #endif | 102 #endif |
107 | 103 |
108 // Prime the cache. | 104 // Prime the cache. |
109 db_.Preload(); | 105 db_.Preload(); |
110 | 106 |
111 // Create the tables and indices. | 107 // Create the tables and indices. |
112 // NOTE: If you add something here, also add it to | 108 // NOTE: If you add something here, also add it to |
113 // RecreateAllButStarAndURLTables. | 109 // RecreateAllButStarAndURLTables. |
114 if (!meta_table_.Init(&db_, GetCurrentVersion(), kCompatibleVersionNumber)) | 110 if (!meta_table_.Init(&db_, GetCurrentVersion(), kCompatibleVersionNumber)) |
115 return sql::INIT_FAILURE; | 111 return sql::INIT_FAILURE; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);"); | 334 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);"); |
339 | 335 |
340 // Erase all the full text index files. These will take a while to update and | 336 // Erase all the full text index files. These will take a while to update and |
341 // are less important, so we just blow them away. Same with the archived | 337 // are less important, so we just blow them away. Same with the archived |
342 // database. | 338 // database. |
343 needs_version_17_migration_ = true; | 339 needs_version_17_migration_ = true; |
344 } | 340 } |
345 #endif | 341 #endif |
346 | 342 |
347 } // namespace history | 343 } // namespace history |
OLD | NEW |