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

Side by Side Diff: components/history/core/browser/visit_database.cc

Issue 1548113002: Switch to standard integer types in components/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 4 years, 12 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
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 "components/history/core/browser/visit_database.h" 5 #include "components/history/core/browser/visit_database.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <algorithm> 10 #include <algorithm>
8 #include <limits> 11 #include <limits>
9 #include <map> 12 #include <map>
10 #include <set> 13 #include <set>
11 14
12 #include "base/logging.h" 15 #include "base/logging.h"
13 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
14 #include "base/time/time.h" 17 #include "base/time/time.h"
15 #include "components/history/core/browser/url_database.h" 18 #include "components/history/core/browser/url_database.h"
16 #include "components/history/core/browser/visit_filter.h" 19 #include "components/history/core/browser/visit_filter.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 int max_results, 307 int max_results,
305 VisitVector* visits) { 308 VisitVector* visits) {
306 visits->clear(); 309 visits->clear();
307 310
308 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 311 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
309 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits " 312 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits "
310 "WHERE visit_time >= ? AND visit_time < ?" 313 "WHERE visit_time >= ? AND visit_time < ?"
311 "ORDER BY visit_time LIMIT ?")); 314 "ORDER BY visit_time LIMIT ?"));
312 315
313 // See GetVisibleVisitsInRange for more info on how these times are bound. 316 // See GetVisibleVisitsInRange for more info on how these times are bound.
314 int64 end = end_time.ToInternalValue(); 317 int64_t end = end_time.ToInternalValue();
315 statement.BindInt64(0, begin_time.ToInternalValue()); 318 statement.BindInt64(0, begin_time.ToInternalValue());
316 statement.BindInt64(1, end ? end : std::numeric_limits<int64>::max()); 319 statement.BindInt64(1, end ? end : std::numeric_limits<int64_t>::max());
317 statement.BindInt64(2, 320 statement.BindInt64(
318 max_results ? max_results : std::numeric_limits<int64>::max()); 321 2, max_results ? max_results : std::numeric_limits<int64_t>::max());
319 322
320 return FillVisitVector(statement, visits); 323 return FillVisitVector(statement, visits);
321 } 324 }
322 325
323 bool VisitDatabase::GetVisitsInRangeForTransition( 326 bool VisitDatabase::GetVisitsInRangeForTransition(
324 base::Time begin_time, 327 base::Time begin_time,
325 base::Time end_time, 328 base::Time end_time,
326 int max_results, 329 int max_results,
327 ui::PageTransition transition, 330 ui::PageTransition transition,
328 VisitVector* visits) { 331 VisitVector* visits) {
329 DCHECK(visits); 332 DCHECK(visits);
330 visits->clear(); 333 visits->clear();
331 334
332 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 335 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
333 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits " 336 "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits "
334 "WHERE visit_time >= ? AND visit_time < ? " 337 "WHERE visit_time >= ? AND visit_time < ? "
335 "AND (transition & ?) == ?" 338 "AND (transition & ?) == ?"
336 "ORDER BY visit_time LIMIT ?")); 339 "ORDER BY visit_time LIMIT ?"));
337 340
338 // See GetVisibleVisitsInRange for more info on how these times are bound. 341 // See GetVisibleVisitsInRange for more info on how these times are bound.
339 int64 end = end_time.ToInternalValue(); 342 int64_t end = end_time.ToInternalValue();
340 statement.BindInt64(0, begin_time.ToInternalValue()); 343 statement.BindInt64(0, begin_time.ToInternalValue());
341 statement.BindInt64(1, end ? end : std::numeric_limits<int64>::max()); 344 statement.BindInt64(1, end ? end : std::numeric_limits<int64_t>::max());
342 statement.BindInt(2, ui::PAGE_TRANSITION_CORE_MASK); 345 statement.BindInt(2, ui::PAGE_TRANSITION_CORE_MASK);
343 statement.BindInt(3, transition); 346 statement.BindInt(3, transition);
344 statement.BindInt64(4, 347 statement.BindInt64(
345 max_results ? max_results : std::numeric_limits<int64>::max()); 348 4, max_results ? max_results : std::numeric_limits<int64_t>::max());
346 349
347 return FillVisitVector(statement, visits); 350 return FillVisitVector(statement, visits);
348 } 351 }
349 352
350 bool VisitDatabase::GetVisibleVisitsInRange(const QueryOptions& options, 353 bool VisitDatabase::GetVisibleVisitsInRange(const QueryOptions& options,
351 VisitVector* visits) { 354 VisitVector* visits) {
352 visits->clear(); 355 visits->clear();
353 // The visit_time values can be duplicated in a redirect chain, so we sort 356 // The visit_time values can be duplicated in a redirect chain, so we sort
354 // by id too, to ensure a consistent ordering just in case. 357 // by id too, to ensure a consistent ordering just in case.
355 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 358 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 // Old versions don't have the visit_duration column, we modify the table 632 // Old versions don't have the visit_duration column, we modify the table
630 // to add that field. 633 // to add that field.
631 if (!GetDB().Execute("ALTER TABLE visits " 634 if (!GetDB().Execute("ALTER TABLE visits "
632 "ADD COLUMN visit_duration INTEGER DEFAULT 0 NOT NULL")) 635 "ADD COLUMN visit_duration INTEGER DEFAULT 0 NOT NULL"))
633 return false; 636 return false;
634 } 637 }
635 return true; 638 return true;
636 } 639 }
637 640
638 } // namespace history 641 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/visit_database.h ('k') | components/history/core/browser/visit_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698