Chromium Code Reviews| Index: chrome/browser/history/history_backend.cc |
| diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc |
| index 2fa226dc351f2c6164ef8c762e32fcbc7ae33726..26a97e4e26a387a5e16e7a10f41107bef52712dd 100644 |
| --- a/chrome/browser/history/history_backend.cc |
| +++ b/chrome/browser/history/history_backend.cc |
| @@ -1699,13 +1699,35 @@ void HistoryBackend::GetFavicons( |
| void HistoryBackend::GetFaviconsForURL( |
| const GURL& page_url, |
| - int icon_types, |
| + const std::vector<int>& icon_types_priority, |
| int desired_size_in_dip, |
| const std::vector<ui::ScaleFactor>& desired_scale_factors, |
| + int threshold_for_next_icon_types, |
| std::vector<chrome::FaviconBitmapResult>* bitmap_results) { |
| - DCHECK(bitmap_results); |
| - GetFaviconsFromDB(page_url, icon_types, desired_size_in_dip, |
| - desired_scale_factors, bitmap_results); |
| + chrome::FaviconBitmapResult bitmap_result; |
| + int bitmap_size_in_pixel = 0; |
| + for (std::vector<int>::const_iterator i = icon_types_priority.begin(); |
| + i != icon_types_priority.end(); i++) { |
| + GetFaviconsFromDB(page_url, *i, desired_size_in_dip, desired_scale_factors, |
|
sky
2013/10/08 23:47:52
Can we do one request with a bitmask of the types
michaelbai
2013/10/09 18:35:09
I see your point, as the icon_types could be a com
sky
2013/10/09 20:33:24
Why? It doesn't seems like it's going to be much m
michaelbai
2013/10/10 05:51:43
I tried, it seemed it is complicated, GetFaviconsF
michaelbai
2013/10/10 18:23:03
To be more specific, AFAIK
- GetIconMappingsForPa
|
| + bitmap_results); |
| + if (icon_types_priority.size() == 1) |
| + return; |
| + |
| + for (std::vector<chrome::FaviconBitmapResult>::const_iterator j = |
| + bitmap_results->begin(); j != bitmap_results->end(); j++) { |
| + if (bitmap_size_in_pixel < j->pixel_size.width() && |
| + bitmap_size_in_pixel < j->pixel_size.height()) { |
| + bitmap_size_in_pixel = std::min(j->pixel_size.width(), |
| + j->pixel_size.height()); |
| + bitmap_result = *j; |
| + } |
| + } |
| + bitmap_results->clear(); |
| + if (bitmap_size_in_pixel > threshold_for_next_icon_types) |
| + break; |
| + } |
| + if (bitmap_size_in_pixel != 0) |
| + bitmap_results->push_back(bitmap_result); |
| } |
| void HistoryBackend::GetFaviconForID( |