diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-29 03:46:27 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-29 03:46:27 +0000 |
commit | 2b8ac34229b953d763712d038eb52bb989e52568 (patch) | |
tree | c3d2b10983efee188778bb43a3d7f2d7f284c31b /chrome/browser/icon_loader_linux.cc | |
parent | d5f6d64a34f875835b5750a54524df9502fb6f68 (diff) | |
download | chromium_src-2b8ac34229b953d763712d038eb52bb989e52568.zip chromium_src-2b8ac34229b953d763712d038eb52bb989e52568.tar.gz chromium_src-2b8ac34229b953d763712d038eb52bb989e52568.tar.bz2 |
Load 2x resources on demand
Currently, this always load 1x. This will be fixed in follow up CL to use currently used scale factor.
* Added thread check to ImageSkiaStorage using NonThreadSafe.
This is important as GetRepresentation may change the stage
now even for the Image obtained from ResourceBundle.
* Added SetReadOnly to protect read only resources (ones in ResourceBundle) from being modified by accident.
* Addded MakeThreadSafe to guarantee that it can be safely accessed from multiple threads.
BUG=141351,144367
TEST=covered by tests. Also run with --force-device-scale-factor=2 and --load-2x-resources and make sure chrome still uses 2x resources where available.
Review URL: https://chromiumcodereview.appspot.com/10820049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/icon_loader_linux.cc')
-rw-r--r-- | chrome/browser/icon_loader_linux.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/chrome/browser/icon_loader_linux.cc b/chrome/browser/icon_loader_linux.cc index f0bb1e6..f5e9c22 100644 --- a/chrome/browser/icon_loader_linux.cc +++ b/chrome/browser/icon_loader_linux.cc @@ -12,6 +12,7 @@ #include "base/message_loop.h" #include "base/nix/mime_util_xdg.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #include "webkit/glue/image_decoder.h" using std::string; @@ -47,7 +48,9 @@ void IconLoader::ReadIcon() { if (!bitmap.empty()) { DCHECK_EQ(size_pixels, bitmap.width()); DCHECK_EQ(size_pixels, bitmap.height()); - image_.reset(new gfx::Image(bitmap)); + gfx::ImageSkia image_skia(bitmap); + image_skia.MakeThreadSafe(); + image_.reset(new gfx::Image(image_skia)); } else { LOG(WARNING) << "Unsupported file type or load error: " << filename.value(); |