summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 08:59:18 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 08:59:18 +0000
commit8fd6f348dd53f9cfdf84dfad1a46252a30bca0fb (patch)
treeb58b63783e0fc0ba0bf996dd3dd2048859073c36 /chrome
parent68764f11c914c41cfdc6d11ce0d66fe547077347 (diff)
downloadchromium_src-8fd6f348dd53f9cfdf84dfad1a46252a30bca0fb.zip
chromium_src-8fd6f348dd53f9cfdf84dfad1a46252a30bca0fb.tar.gz
chromium_src-8fd6f348dd53f9cfdf84dfad1a46252a30bca0fb.tar.bz2
Temporary change to test perf regression (full)
This change tests which part of this review: http://codereview.chromium.org/6897013/ is causing a performance regression. This change will be reverted later tonight. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/themes/theme_service_mac.mm16
-rw-r--r--chrome/browser/ui/tests/ui_gfx_image_unittest.cc4
-rw-r--r--chrome/browser/ui/tests/ui_gfx_image_unittest.mm6
-rw-r--r--chrome/chrome_tests.gypi2
4 files changed, 21 insertions, 7 deletions
diff --git a/chrome/browser/themes/theme_service_mac.mm b/chrome/browser/themes/theme_service_mac.mm
index 30d359e..73fd814 100644
--- a/chrome/browser/themes/theme_service_mac.mm
+++ b/chrome/browser/themes/theme_service_mac.mm
@@ -10,7 +10,9 @@
#include "chrome/browser/themes/browser_theme_pack.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/GTM/AppKit/GTMNSColor+Luminance.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_utils.h"
+#include "ui/gfx/image.h"
NSString* const kBrowserThemeDidChangeNotification =
@"BrowserThemeDidChangeNotification";
@@ -44,8 +46,18 @@ NSImage* ThemeService::GetNSImageNamed(int id, bool allow_default) const {
// SkBitmap > native conversion?
// - For consistency with other platforms.
// - To get the generated tinted images.
- SkBitmap* bitmap = GetBitmapNamed(id);
- NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap);
+ NSImage* nsimage = nil;
+ if (theme_pack_.get()) {
+ SkBitmap* bitmap = theme_pack_->GetBitmapNamed(id);
+ if (bitmap)
+ nsimage = gfx::SkBitmapToNSImage(*bitmap);
+ }
+
+ // If the theme didn't override this image then load it from the resource
+ // bundle.
+ if (!nsimage) {
+ nsimage = rb_.GetNativeImageNamed(id);
+ }
// We loaded successfully. Cache the image.
if (nsimage) {
diff --git a/chrome/browser/ui/tests/ui_gfx_image_unittest.cc b/chrome/browser/ui/tests/ui_gfx_image_unittest.cc
index cfe1c9b..7c8f100 100644
--- a/chrome/browser/ui/tests/ui_gfx_image_unittest.cc
+++ b/chrome/browser/ui/tests/ui_gfx_image_unittest.cc
@@ -6,7 +6,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image.h"
-#include "ui/gfx/image_unittest.h"
+#include "ui/gfx/image_unittest_util.h"
#if defined(OS_LINUX)
#include <gtk/gtk.h>
@@ -43,7 +43,7 @@ TEST(UiGfxImageTest, GtkImageView) {
GtkWidget* fixed = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(window), fixed);
- gfx::Image image(gfx::test::CreateBitmap());
+ gfx::Image image(gfx::test::CreateBitmap(25, 25));
GtkWidget* image_view = gtk_image_new_from_pixbuf(image);
gtk_fixed_put(GTK_FIXED(fixed), image_view, 10, 10);
gtk_widget_set_size_request(image_view, 25, 25);
diff --git a/chrome/browser/ui/tests/ui_gfx_image_unittest.mm b/chrome/browser/ui/tests/ui_gfx_image_unittest.mm
index 9f62332..7245ff1 100644
--- a/chrome/browser/ui/tests/ui_gfx_image_unittest.mm
+++ b/chrome/browser/ui/tests/ui_gfx_image_unittest.mm
@@ -9,7 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image.h"
-#include "ui/gfx/image_unittest.h"
+#include "ui/gfx/image_unittest_util.h"
namespace {
@@ -17,7 +17,7 @@ class UiGfxImageTest : public CocoaTest {
};
TEST_F(UiGfxImageTest, CheckColor) {
- gfx::Image image(gfx::test::CreateBitmap());
+ gfx::Image image(gfx::test::CreateBitmap(25, 25));
[image lockFocus];
NSColor* color = NSReadPixel(NSMakePoint(10, 10));
[image unlockFocus];
@@ -42,7 +42,7 @@ TEST_F(UiGfxImageTest, ImageView) {
[[test_window() contentView] addSubview:image_view];
[test_window() orderFront:nil];
- gfx::Image image(gfx::test::CreateBitmap());
+ gfx::Image image(gfx::test::CreateBitmap(25, 25));
[image_view setImage:image];
}
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 10d040b..5f78970 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -191,6 +191,8 @@
'../content/browser/tab_contents/test_tab_contents.h',
'../content/common/notification_observer_mock.cc',
'../content/common/notification_observer_mock.h',
+ '../ui/gfx/image_unittest_util.h',
+ '../ui/gfx/image_unittest_util.cc',
],
'conditions': [
['OS=="linux"', {