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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 9662021: Fixed pass-by-value to pass-by-reference (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed unit test compile errors Created 8 years, 9 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: chrome/browser/tab_contents/thumbnail_generator.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index 83899a226b2264ff17ca291e8387f0e69267f284..6877c721d4ab2e81f1ca154fd1efca4405b5dee6 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -375,14 +375,14 @@ void ThumbnailGenerator::WebContentsDisconnected(WebContents* contents) {
}
}
-double ThumbnailGenerator::CalculateBoringScore(SkBitmap* bitmap) {
- if (bitmap->isNull() || bitmap->empty())
+double ThumbnailGenerator::CalculateBoringScore(const SkBitmap& bitmap) {
+ if (bitmap.isNull() || bitmap.empty())
return 1.0;
int histogram[256] = {0};
color_utils::BuildLumaHistogram(bitmap, histogram);
int color_count = *std::max_element(histogram, histogram + 256);
- int pixel_count = bitmap->width() * bitmap->height();
+ int pixel_count = bitmap.width() * bitmap.height();
return static_cast<double>(color_count) / pixel_count;
}
@@ -457,7 +457,7 @@ void ThumbnailGenerator::UpdateThumbnailIfNecessary(
}
void ThumbnailGenerator::UpdateThumbnail(
- WebContents* web_contents, SkBitmap thumbnail,
+ WebContents* web_contents, const SkBitmap& thumbnail,
const ThumbnailGenerator::ClipResult& clip_result) {
Profile* profile =
@@ -470,7 +470,7 @@ void ThumbnailGenerator::UpdateThumbnail(
ThumbnailScore score;
score.at_top =
(web_contents->GetRenderViewHost()->GetLastScrollOffset().y() == 0);
- score.boring_score = ThumbnailGenerator::CalculateBoringScore(&thumbnail);
+ score.boring_score = ThumbnailGenerator::CalculateBoringScore(thumbnail);
score.good_clipping =
(clip_result == ThumbnailGenerator::kTallerThanWide ||
clip_result == ThumbnailGenerator::kNotClipped);
« no previous file with comments | « chrome/browser/tab_contents/thumbnail_generator.h ('k') | chrome/browser/tab_contents/thumbnail_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698