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

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

Issue 113591: Fix Acid3 Test 48: LINKTEST, Chromium side.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Made waiting more bearable. Created 11 years, 5 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
« no previous file with comments | « chrome/browser/history/history_database.h ('k') | chrome/browser/history/redirect_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/common/sqlite_utils.h" 11 #include "chrome/common/sqlite_utils.h"
12 12
13 using base::Time;
14
13 namespace history { 15 namespace history {
14 16
15 namespace { 17 namespace {
16 18
17 // Current version number. 19 // Current version number.
18 static const int kCurrentVersionNumber = 16; 20 static const int kCurrentVersionNumber = 16;
19 static const int kCompatibleVersionNumber = 16; 21 static const int kCompatibleVersionNumber = 16;
22 static const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold";
20 23
21 } // namespace 24 } // namespace
22 25
23 HistoryDatabase::HistoryDatabase() 26 HistoryDatabase::HistoryDatabase()
24 : transaction_nesting_(0), 27 : transaction_nesting_(0),
25 db_(NULL) { 28 db_(NULL) {
26 } 29 }
27 30
28 HistoryDatabase::~HistoryDatabase() { 31 HistoryDatabase::~HistoryDatabase() {
29 } 32 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 s.bind_int64(0, visit_id); 167 s.bind_int64(0, visit_id);
165 if (s.step() == SQLITE_ROW) { 168 if (s.step() == SQLITE_ROW) {
166 if (s.column_type(0) == SQLITE_NULL) 169 if (s.column_type(0) == SQLITE_NULL)
167 return 0; 170 return 0;
168 else 171 else
169 return s.column_int64(0); 172 return s.column_int64(0);
170 } 173 }
171 return 0; 174 return 0;
172 } 175 }
173 176
177 Time HistoryDatabase::GetEarlyExpirationThreshold() {
178 if (!cached_early_expiration_threshold_.is_null())
179 return cached_early_expiration_threshold_;
180
181 int64 threshold;
182 if (!meta_table_.GetValue(kEarlyExpirationThresholdKey, &threshold)) {
183 // Set to a very early non-zero time, so it's before all history, but not
184 // zero to avoid re-retrieval.
185 threshold = 1L;
186 }
187
188 cached_early_expiration_threshold_ = Time::FromInternalValue(threshold);
189 return cached_early_expiration_threshold_;
190 }
191
192 void HistoryDatabase::UpdateEarlyExpirationThreshold(Time threshold) {
193 meta_table_.SetValue(kEarlyExpirationThresholdKey,
194 threshold.ToInternalValue());
195 cached_early_expiration_threshold_ = threshold;
196 }
197
174 sqlite3* HistoryDatabase::GetDB() { 198 sqlite3* HistoryDatabase::GetDB() {
175 return db_; 199 return db_;
176 } 200 }
177 201
178 SqliteStatementCache& HistoryDatabase::GetStatementCache() { 202 SqliteStatementCache& HistoryDatabase::GetStatementCache() {
179 return *statement_cache_; 203 return *statement_cache_;
180 } 204 }
181 205
182 // Migration ------------------------------------------------------------------- 206 // Migration -------------------------------------------------------------------
183 207
(...skipping 29 matching lines...) Expand all
213 237
214 // When the version is too old, we just try to continue anyway, there should 238 // When the version is too old, we just try to continue anyway, there should
215 // not be a released product that makes a database too old for us to handle. 239 // not be a released product that makes a database too old for us to handle.
216 LOG_IF(WARNING, cur_version < kCurrentVersionNumber) << 240 LOG_IF(WARNING, cur_version < kCurrentVersionNumber) <<
217 "History database version " << cur_version << " is too old to handle."; 241 "History database version " << cur_version << " is too old to handle.";
218 242
219 return INIT_OK; 243 return INIT_OK;
220 } 244 }
221 245
222 } // namespace history 246 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_database.h ('k') | chrome/browser/history/redirect_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698