OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/favicon/core/large_icon_service.h" | 5 #include "components/favicon/core/large_icon_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 *bitmap = image.AsBitmap(); | 110 *bitmap = image.AsBitmap(); |
111 } | 111 } |
112 return; | 112 return; |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 if (!fallback_icon_style) | 116 if (!fallback_icon_style) |
117 return; | 117 return; |
118 | 118 |
119 *fallback_icon_style = favicon_base::FallbackIconStyle(); | 119 *fallback_icon_style = favicon_base::FallbackIconStyle(); |
120 int fallback_icon_size = 0; | |
120 if (db_result.is_valid()) { | 121 if (db_result.is_valid()) { |
121 favicon_base::SetDominantColorAsBackground(db_result.bitmap_data, | 122 favicon_base::SetDominantColorAsBackground(db_result.bitmap_data, |
122 fallback_icon_style); | 123 fallback_icon_style); |
124 fallback_icon_size = db_result.pixel_size.width(); | |
123 } | 125 } |
126 UMA_HISTOGRAM_COUNTS_100("Favicons.LargeIconService.FallbackSize", | |
127 fallback_icon_size); | |
Ilya Sherman
2017/04/11 21:36:09
Perhaps UMA_HISTOGRAM_SPARSE_SLOWLY, with some cus
jkrcal
2017/04/12 05:40:51
Done.
No sanity checks are needed as this must be
Ilya Sherman
2017/04/12 20:45:33
Okay. Could you please add a DCHECK at least? =)
jkrcal
2017/04/13 07:16:05
Done (I check only the lower limit, the upper limi
| |
124 } | 128 } |
125 | 129 |
126 // Processes the bitmap data returned from the FaviconService as part of a | 130 // Processes the bitmap data returned from the FaviconService as part of a |
127 // LargeIconService request. | 131 // LargeIconService request. |
128 class LargeIconWorker : public base::RefCountedThreadSafe<LargeIconWorker> { | 132 class LargeIconWorker : public base::RefCountedThreadSafe<LargeIconWorker> { |
129 public: | 133 public: |
130 // Exactly one of the callbacks is expected to be non-null. | 134 // Exactly one of the callbacks is expected to be non-null. |
131 LargeIconWorker(int min_source_size_in_pixel, | 135 LargeIconWorker(int min_source_size_in_pixel, |
132 int desired_size_in_pixel, | 136 int desired_size_in_pixel, |
133 favicon_base::LargeIconCallback raw_bitmap_callback, | 137 favicon_base::LargeIconCallback raw_bitmap_callback, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 // TODO(beaudoin): For now this is just a wrapper around | 348 // TODO(beaudoin): For now this is just a wrapper around |
345 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 349 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
346 // possible large icon. Also add logic to fetch-on-demand when the URL of | 350 // possible large icon. Also add logic to fetch-on-demand when the URL of |
347 // a large icon is known but its bitmap is not available. | 351 // a large icon is known but its bitmap is not available. |
348 return favicon_service_->GetLargestRawFaviconForPageURL( | 352 return favicon_service_->GetLargestRawFaviconForPageURL( |
349 page_url, large_icon_types_, min_source_size_in_pixel, | 353 page_url, large_icon_types_, min_source_size_in_pixel, |
350 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 354 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); |
351 } | 355 } |
352 | 356 |
353 } // namespace favicon | 357 } // namespace favicon |
OLD | NEW |