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

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

Issue 10669038: base: Remove dereference structure operator (i.e ->) from ScopedVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | 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_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 1487
1488 std::map<URLID, double> score_map; 1488 std::map<URLID, double> score_map;
1489 for (size_t i = 0; i < visits.size(); ++i) { 1489 for (size_t i = 0; i < visits.size(); ++i) {
1490 score_map[visits[i].url_id] += filter.GetVisitScore(visits[i]); 1490 score_map[visits[i].url_id] += filter.GetVisitScore(visits[i]);
1491 } 1491 }
1492 1492
1493 // TODO(georgey): experiment with visit_segment database granularity (it is 1493 // TODO(georgey): experiment with visit_segment database granularity (it is
1494 // currently 24 hours) to use it directly instead of using visits database, 1494 // currently 24 hours) to use it directly instead of using visits database,
1495 // which is considerably slower. 1495 // which is considerably slower.
1496 ScopedVector<PageUsageData> data; 1496 ScopedVector<PageUsageData> data;
1497 data->reserve(score_map.size()); 1497 data.reserve(score_map.size());
1498 for (std::map<URLID, double>::iterator it = score_map.begin(); 1498 for (std::map<URLID, double>::iterator it = score_map.begin();
1499 it != score_map.end(); ++it) { 1499 it != score_map.end(); ++it) {
1500 PageUsageData* pud = new PageUsageData(it->first); 1500 PageUsageData* pud = new PageUsageData(it->first);
1501 pud->SetScore(it->second); 1501 pud->SetScore(it->second);
1502 data->push_back(pud); 1502 data.push_back(pud);
1503 } 1503 }
1504 1504
1505 // Limit to the top |result_count| results. 1505 // Limit to the top |result_count| results.
1506 std::sort(data.begin(), data.end(), PageUsageData::Predicate); 1506 std::sort(data.begin(), data.end(), PageUsageData::Predicate);
1507 if (result_count && static_cast<int>(data.size()) > result_count) { 1507 if (result_count && static_cast<int>(data.size()) > result_count) {
1508 STLDeleteContainerPointers(data.begin() + result_count, data.end()); 1508 STLDeleteContainerPointers(data.begin() + result_count, data.end());
1509 data.resize(result_count); 1509 data.resize(result_count);
1510 } 1510 }
1511 1511
1512 for (size_t i = 0; i < data.size(); ++i) { 1512 for (size_t i = 0; i < data.size(); ++i) {
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 info.url_id = visit.url_id; 2484 info.url_id = visit.url_id;
2485 info.time = visit.visit_time; 2485 info.time = visit.visit_time;
2486 info.transition = visit.transition; 2486 info.transition = visit.transition;
2487 // If we don't have a delegate yet during setup or shutdown, we will drop 2487 // If we don't have a delegate yet during setup or shutdown, we will drop
2488 // these notifications. 2488 // these notifications.
2489 if (delegate_.get()) 2489 if (delegate_.get())
2490 delegate_->NotifyVisitDBObserversOnAddVisit(info); 2490 delegate_->NotifyVisitDBObserversOnAddVisit(info);
2491 } 2491 }
2492 2492
2493 } // namespace history 2493 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_parser_unittest.cc ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698