Chromium Code Reviews| Index: components/history/core/browser/history_backend.cc |
| diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc |
| index 9cee47e892206bc47375990ca108894dcadbdcfa..eb4dae22d2f7e3e4321fc9e62a52c334393d0a6a 100644 |
| --- a/components/history/core/browser/history_backend.cc |
| +++ b/components/history/core/browser/history_backend.cc |
| @@ -424,7 +424,7 @@ TopHostsList HistoryBackend::TopHosts(size_t num_hosts) const { |
| return top_hosts; |
| } |
| -OriginCountMap HistoryBackend::GetCountsForOrigins( |
| +OriginCountMap HistoryBackend::GetCountsAndLastVisitForOrigins( |
| const std::set<GURL>& origins) const { |
| if (!db_) |
| return OriginCountMap(); |
| @@ -435,13 +435,17 @@ OriginCountMap HistoryBackend::GetCountsForOrigins( |
| OriginCountMap origin_count_map; |
| for (const GURL& origin : origins) |
| - origin_count_map[origin] = 0; |
| + origin_count_map[origin] = std::make_pair(0, base::Time()); |
| URLRow row; |
| while (it.GetNextURL(&row)) { |
| GURL origin = row.url().GetOrigin(); |
| - if (ContainsValue(origins, origin)) |
| - ++origin_count_map[origin]; |
| + if (ContainsValue(origins, origin)) { |
|
sdefresne
2016/04/19 07:18:01
nit: I would change to this instead to avoid doing
dominickn
2016/04/19 07:59:32
Done.
|
| + std::pair<int, base::Time>& value = origin_count_map[origin]; |
| + ++(value.first); |
| + if (value.second.is_null() || value.second < row.last_visit()) |
| + value.second = row.last_visit(); |
| + } |
| } |
| return origin_count_map; |