Commit 3e9d30ee authored by thakis@chromium.org's avatar thakis@chromium.org

mac: Let task manager use IDR_PRODUCT_LOGO_16 instead of NSApplicationIcon.

According to `purge; sample -wait Chromium` and launching
out/Release/Chromium.app/Contents/MacOS with 30 wikipedia tabs, this reduces
time spent creating the TaskManagerModel (which happens on the IO thread, in
response to raw bytes arriving from the network) from ~100 samples to ~1 sample.
The icon looks slightly different from the icon that Activity Monitor displays,
but a) it looks arguably nicer now (sharp) and b) most people never open the
task manager.

BUG=none
NOTRY=true

Review URL: https://codereview.chromium.org/190533009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255797 0039d316-1c4b-4281-b951-d872f2087c98
parent f0e6b93b
...@@ -43,19 +43,11 @@ BrowserProcessResource::BrowserProcessResource() ...@@ -43,19 +43,11 @@ BrowserProcessResource::BrowserProcessResource()
default_icon_ = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); default_icon_ = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f));
} }
} }
#elif defined(OS_POSIX) && !defined(OS_MACOSX) #elif defined(OS_POSIX)
if (!default_icon_) { if (!default_icon_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance(); ResourceBundle& rb = ResourceBundle::GetSharedInstance();
default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16);
} }
#elif defined(OS_MACOSX)
if (!default_icon_) {
// IDR_PRODUCT_LOGO_16 doesn't quite look like chrome/mac's icns icon. Load
// the real app icon (requires a nsimage->image_skia->nsimage
// conversion :-().
default_icon_ = new gfx::ImageSkia(gfx::ApplicationIconAtSize(16));
}
#else
// TODO(port): Port icon code. // TODO(port): Port icon code.
NOTIMPLEMENTED(); NOTIMPLEMENTED();
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
......
...@@ -31,10 +31,6 @@ GFX_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image); ...@@ -31,10 +31,6 @@ GFX_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image);
GFX_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image, GFX_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image,
NSSize size); NSSize size);
// Resizes |[NSImage imageNamed:@NSApplicationIcon]| to have edge width of
// |size| DIP and returns result as ImageSkia.
GFX_EXPORT gfx::ImageSkia ApplicationIconAtSize(int size);
// Converts to NSImage from ImageSkia. // Converts to NSImage from ImageSkia.
GFX_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia); GFX_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia);
......
...@@ -78,12 +78,6 @@ gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image, ...@@ -78,12 +78,6 @@ gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image,
return image_skia; return image_skia;
} }
gfx::ImageSkia ApplicationIconAtSize(int desired_size) {
NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"];
return ImageSkiaFromResizedNSImage(image,
NSMakeSize(desired_size, desired_size));
}
NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia) { NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia) {
if (image_skia.isNull()) if (image_skia.isNull())
return nil; return nil;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment