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

Unified Diff: chrome/browser/icon_loader_chromeos.cc

Issue 10378009: Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: k Created 8 years, 7 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
« no previous file with comments | « chrome/browser/history/top_sites_unittest.cc ('k') | chrome/browser/icon_loader_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader_chromeos.cc
diff --git a/chrome/browser/icon_loader_chromeos.cc b/chrome/browser/icon_loader_chromeos.cc
index 14692be13eadafdf476416ffb2e37108418d9ca4..cc4739f7bc8e8409ca99d6af2814b2c31e4ec7f1 100644
--- a/chrome/browser/icon_loader_chromeos.cc
+++ b/chrome/browser/icon_loader_chromeos.cc
@@ -164,15 +164,15 @@ int IconMapper::Lookup(const std::string& extension,
// Returns a copy of |source| that is |pixel_size| in width and height. If
// |pixel_size| is |kDoNotResize|, returns an unmodified copy of |source|.
// |source| must be a square image (width == height).
-SkBitmap* GenerateBitmapWithSize(SkBitmap* source, int pixel_size) {
- DCHECK(source);
- DCHECK(source->width() == source->height());
+SkBitmap GenerateBitmapWithSize(const SkBitmap& source, int pixel_size) {
+ DCHECK(!source.isNull());
+ DCHECK(source.width() == source.height());
- if (pixel_size == kDoNotResize || source->width() == pixel_size)
- return new SkBitmap(*source);
+ if (pixel_size == kDoNotResize || source.width() == pixel_size)
+ return source;
- return new SkBitmap(skia::ImageOperations::Resize(
- *source, skia::ImageOperations::RESIZE_BEST, pixel_size, pixel_size));
+ return skia::ImageOperations::Resize(
+ source, skia::ImageOperations::RESIZE_BEST, pixel_size, pixel_size);
}
int IconSizeToPixelSize(IconLoader::IconSize size) {
@@ -203,7 +203,7 @@ void IconLoader::ReadIcon() {
if (!gfx::PNGCodec::Decode(bytes->front(), bytes->size(), &bitmap))
NOTREACHED();
image_.reset(new gfx::Image(
- GenerateBitmapWithSize(&bitmap, IconSizeToPixelSize(icon_size_))));
+ GenerateBitmapWithSize(bitmap, IconSizeToPixelSize(icon_size_))));
target_message_loop_->PostTask(
FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this));
}
« no previous file with comments | « chrome/browser/history/top_sites_unittest.cc ('k') | chrome/browser/icon_loader_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698