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

Side by Side Diff: chrome/browser/history/history_database.cc

Issue 9592026: Create meta table atomically. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 void HistoryDatabase::UpdateEarlyExpirationThreshold(base::Time threshold) { 227 void HistoryDatabase::UpdateEarlyExpirationThreshold(base::Time threshold) {
228 meta_table_.SetValue(kEarlyExpirationThresholdKey, 228 meta_table_.SetValue(kEarlyExpirationThresholdKey,
229 threshold.ToInternalValue()); 229 threshold.ToInternalValue());
230 cached_early_expiration_threshold_ = threshold; 230 cached_early_expiration_threshold_ = threshold;
231 } 231 }
232 232
233 sql::Connection& HistoryDatabase::GetDB() { 233 sql::Connection& HistoryDatabase::GetDB() {
234 return db_; 234 return db_;
235 } 235 }
236 236
237 sql::MetaTable& HistoryDatabase::GetMetaTable() {
238 return meta_table_;
239 }
240
237 // Migration ------------------------------------------------------------------- 241 // Migration -------------------------------------------------------------------
238 242
239 sql::InitStatus HistoryDatabase::EnsureCurrentVersion( 243 sql::InitStatus HistoryDatabase::EnsureCurrentVersion(
240 const FilePath& tmp_bookmarks_path) { 244 const FilePath& tmp_bookmarks_path) {
241 // We can't read databases newer than we were designed for. 245 // We can't read databases newer than we were designed for.
242 if (meta_table_.GetCompatibleVersionNumber() > kCurrentVersionNumber) { 246 if (meta_table_.GetCompatibleVersionNumber() > kCurrentVersionNumber) {
243 LOG(WARNING) << "History database is too new."; 247 LOG(WARNING) << "History database is too new.";
244 return sql::INIT_TOO_NEW; 248 return sql::INIT_TOO_NEW;
245 } 249 }
246 250
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 "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);"));
331 335
332 // 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
333 // 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
334 // database. 338 // database.
335 needs_version_17_migration_ = true; 339 needs_version_17_migration_ = true;
336 } 340 }
337 #endif 341 #endif
338 342
339 } // namespace history 343 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698