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

Side by Side Diff: chrome/browser/history/visit_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/visit_database.h ('k') | chrome/browser/profile.h » ('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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "chrome/browser/history/visit_database.h" 10 #include "chrome/browser/history/visit_database.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // See GetVisibleVisitsInRange for more info on how these times are bound. 206 // See GetVisibleVisitsInRange for more info on how these times are bound.
207 int64 end = end_time.ToInternalValue(); 207 int64 end = end_time.ToInternalValue();
208 statement->bind_int64(0, begin_time.ToInternalValue()); 208 statement->bind_int64(0, begin_time.ToInternalValue());
209 statement->bind_int64(1, end ? end : std::numeric_limits<int64>::max()); 209 statement->bind_int64(1, end ? end : std::numeric_limits<int64>::max());
210 statement->bind_int64(2, 210 statement->bind_int64(2,
211 max_results ? max_results : std::numeric_limits<int64>::max()); 211 max_results ? max_results : std::numeric_limits<int64>::max());
212 212
213 FillVisitVector(*statement, visits); 213 FillVisitVector(*statement, visits);
214 } 214 }
215 215
216 void VisitDatabase::GetVisitsInRangeForTransition(
217 Time begin_time,
218 Time end_time,
219 int max_results,
220 PageTransition::Type transition,
221 VisitVector* visits) {
222 DCHECK(visits);
223 visits->clear();
224
225 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(),
226 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits "
227 "WHERE visit_time >= ? AND visit_time < ? "
228 "AND (transition & ?) == ?"
229 "ORDER BY visit_time LIMIT ?");
230 if (!statement.is_valid())
231 return;
232
233 // See GetVisibleVisitsInRange for more info on how these times are bound.
234 int64 end = end_time.ToInternalValue();
235 statement->bind_int64(0, begin_time.ToInternalValue());
236 statement->bind_int64(1, end ? end : std::numeric_limits<int64>::max());
237 statement->bind_int(2, PageTransition::CORE_MASK);
238 statement->bind_int(3, transition);
239 statement->bind_int64(4,
240 max_results ? max_results : std::numeric_limits<int64>::max());
241
242 FillVisitVector(*statement, visits);
243 }
244
216 void VisitDatabase::GetVisibleVisitsInRange(Time begin_time, Time end_time, 245 void VisitDatabase::GetVisibleVisitsInRange(Time begin_time, Time end_time,
217 bool most_recent_visit_only, 246 bool most_recent_visit_only,
218 int max_count, 247 int max_count,
219 VisitVector* visits) { 248 VisitVector* visits) {
220 visits->clear(); 249 visits->clear();
221 // The visit_time values can be duplicated in a redirect chain, so we sort 250 // The visit_time values can be duplicated in a redirect chain, so we sort
222 // by id too, to ensure a consistent ordering just in case. 251 // by id too, to ensure a consistent ordering just in case.
223 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), 252 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(),
224 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits " 253 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits "
225 "WHERE visit_time >= ? AND visit_time < ? " 254 "WHERE visit_time >= ? AND visit_time < ? "
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 if (!statement.is_valid() || statement->step() != SQLITE_ROW || 430 if (!statement.is_valid() || statement->step() != SQLITE_ROW ||
402 statement->column_int64(0) == 0) { 431 statement->column_int64(0) == 0) {
403 *first_visit = Time::Now(); 432 *first_visit = Time::Now();
404 return false; 433 return false;
405 } 434 }
406 *first_visit = Time::FromInternalValue(statement->column_int64(0)); 435 *first_visit = Time::FromInternalValue(statement->column_int64(0));
407 return true; 436 return true;
408 } 437 }
409 438
410 } // namespace history 439 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/visit_database.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698