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

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

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implicitcast: numericstest Created 5 years, 3 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/visitsegment_database.h" 5 #include "components/history/core/browser/visitsegment_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 score += recency_boost * day_visits_score; 251 score += recency_boost * day_visits_score;
252 } 252 }
253 253
254 if (pud) { 254 if (pud) {
255 pud->SetScore(score); 255 pud->SetScore(score);
256 results->push_back(pud); 256 results->push_back(pud);
257 } 257 }
258 258
259 // Limit to the top kResultCount results. 259 // Limit to the top kResultCount results.
260 std::sort(results->begin(), results->end(), PageUsageData::Predicate); 260 std::sort(results->begin(), results->end(), PageUsageData::Predicate);
261 if (static_cast<int>(results->size()) > max_result_count) { 261 DCHECK_GE(max_result_count, 0);
262 if (results->size() > static_cast<size_t>(max_result_count)) {
262 STLDeleteContainerPointers(results->begin() + max_result_count, 263 STLDeleteContainerPointers(results->begin() + max_result_count,
263 results->end()); 264 results->end());
264 results->resize(max_result_count); 265 results->resize(max_result_count);
265 } 266 }
266 267
267 // Now fetch the details about the entries we care about. 268 // Now fetch the details about the entries we care about.
268 sql::Statement statement2(GetDB().GetCachedStatement(SQL_FROM_HERE, 269 sql::Statement statement2(GetDB().GetCachedStatement(SQL_FROM_HERE,
269 "SELECT urls.url, urls.title FROM urls " 270 "SELECT urls.url, urls.title FROM urls "
270 "JOIN segments ON segments.url_id = urls.id " 271 "JOIN segments ON segments.url_id = urls.id "
271 "WHERE segments.id = ?")); 272 "WHERE segments.id = ?"));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 "name VARCHAR," 318 "name VARCHAR,"
318 "url_id INTEGER NON NULL)") && 319 "url_id INTEGER NON NULL)") &&
319 GetDB().Execute("INSERT INTO segments_tmp SELECT " 320 GetDB().Execute("INSERT INTO segments_tmp SELECT "
320 "id, name, url_id FROM segments") && 321 "id, name, url_id FROM segments") &&
321 GetDB().Execute("DROP TABLE segments") && 322 GetDB().Execute("DROP TABLE segments") &&
322 GetDB().Execute("ALTER TABLE segments_tmp RENAME TO segments") && 323 GetDB().Execute("ALTER TABLE segments_tmp RENAME TO segments") &&
323 transaction.Commit(); 324 transaction.Commit();
324 } 325 }
325 326
326 } // namespace history 327 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_backend.cc ('k') | content/browser/cache_storage/cache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698