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

Unified Diff: components/history/core/browser/history_backend.cc

Issue 2313563002: Reduce jank from favicon downscaling. (Closed)
Patch Set: Rename to ResizeFaviconBitmapResult Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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 f9e2b57d30b84da86b32032e04514abc76979d12..ff46dd8c34b1032a78050d742cfe70eacf79389e 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -24,7 +24,9 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
+#include "components/favicon_base/favicon_util.h"
#include "components/favicon_base/select_favicon_frames.h"
#include "components/history/core/browser/download_constants.h"
#include "components/history/core/browser/download_row.h"
@@ -1569,14 +1571,20 @@ void HistoryBackend::GetFaviconsForURL(
int icon_types,
const std::vector<int>& desired_sizes,
std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) {
+ TRACE_EVENT0("browser", "HistoryBackend::GetFaviconsForURL");
DCHECK(bitmap_results);
GetFaviconsFromDB(page_url, icon_types, desired_sizes, bitmap_results);
+
+ if (desired_sizes.size() == 1)
+ bitmap_results->assign(1, favicon_base::ResizeFaviconBitmapResult(
+ *bitmap_results, desired_sizes[0]));
}
void HistoryBackend::GetFaviconForID(
favicon_base::FaviconID favicon_id,
int desired_size,
std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) {
+ TRACE_EVENT0("browser", "HistoryBackend::GetFaviconForID");
std::vector<favicon_base::FaviconID> favicon_ids;
favicon_ids.push_back(favicon_id);
std::vector<int> desired_sizes;
@@ -1585,6 +1593,9 @@ void HistoryBackend::GetFaviconForID(
// Get results from DB.
GetFaviconBitmapResultsForBestMatch(favicon_ids, desired_sizes,
bitmap_results);
+
+ bitmap_results->assign(1, favicon_base::ResizeFaviconBitmapResult(
+ *bitmap_results, desired_size));
}
void HistoryBackend::UpdateFaviconMappingsAndFetch(

Powered by Google App Engine
This is Rietveld 408576698