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

Side by Side Diff: components/favicon/core/large_icon_service.cc

Issue 2809783003: [LargeIconService] Report size of favicon for fallback style to UMA (Closed)
Patch Set: Ilya's comment #2 Created 3 years, 8 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
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
125 DCHECK_GT(fallback_icon_size, 0);
Ilya Sherman 2017/04/13 07:46:29 Hmm, if the API allows setting an arbitrary upper
123 } 126 }
127 UMA_HISTOGRAM_SPARSE_SLOWLY("Favicons.LargeIconService.FallbackSize",
128 fallback_icon_size);
124 } 129 }
125 130
126 // Processes the bitmap data returned from the FaviconService as part of a 131 // Processes the bitmap data returned from the FaviconService as part of a
127 // LargeIconService request. 132 // LargeIconService request.
128 class LargeIconWorker : public base::RefCountedThreadSafe<LargeIconWorker> { 133 class LargeIconWorker : public base::RefCountedThreadSafe<LargeIconWorker> {
129 public: 134 public:
130 // Exactly one of the callbacks is expected to be non-null. 135 // Exactly one of the callbacks is expected to be non-null.
131 LargeIconWorker(int min_source_size_in_pixel, 136 LargeIconWorker(int min_source_size_in_pixel,
132 int desired_size_in_pixel, 137 int desired_size_in_pixel,
133 favicon_base::LargeIconCallback raw_bitmap_callback, 138 favicon_base::LargeIconCallback raw_bitmap_callback,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // TODO(beaudoin): For now this is just a wrapper around 349 // TODO(beaudoin): For now this is just a wrapper around
345 // GetLargestRawFaviconForPageURL. Add the logic required to select the best 350 // GetLargestRawFaviconForPageURL. Add the logic required to select the best
346 // possible large icon. Also add logic to fetch-on-demand when the URL of 351 // 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. 352 // a large icon is known but its bitmap is not available.
348 return favicon_service_->GetLargestRawFaviconForPageURL( 353 return favicon_service_->GetLargestRawFaviconForPageURL(
349 page_url, large_icon_types_, min_source_size_in_pixel, 354 page_url, large_icon_types_, min_source_size_in_pixel,
350 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); 355 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker);
351 } 356 }
352 357
353 } // namespace favicon 358 } // namespace favicon
OLDNEW
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698