| Index: ui/base/resource/resource_bundle_gtk.cc
|
| ===================================================================
|
| --- ui/base/resource/resource_bundle_gtk.cc (revision 133962)
|
| +++ ui/base/resource/resource_bundle_gtk.cc (working copy)
|
| @@ -63,28 +63,34 @@
|
| return *found->second;
|
| }
|
|
|
| - scoped_refptr<base::RefCountedStaticMemory> data(
|
| - LoadDataResourceBytes(resource_id));
|
| - GdkPixbuf* pixbuf = LoadPixbuf(data.get(), rtl == RTL_ENABLED);
|
| + gfx::Image* image = NULL;
|
| + if (delegate_)
|
| + image = delegate_->GetNativeImageNamed(resource_id, rtl);
|
|
|
| - // The load was successful, so cache the image.
|
| - if (pixbuf) {
|
| - base::AutoLock lock_scope(*images_and_fonts_lock_);
|
| + if (!image) {
|
| + scoped_refptr<base::RefCountedStaticMemory> data(
|
| + LoadDataResourceBytes(resource_id));
|
| + GdkPixbuf* pixbuf = LoadPixbuf(data.get(), rtl == RTL_ENABLED);
|
|
|
| - // Another thread raced the load and has already cached the image.
|
| - if (images_.count(key)) {
|
| - g_object_unref(pixbuf);
|
| - return *images_[key];
|
| + if (!pixbuf) {
|
| + LOG(WARNING) << "Unable to load pixbuf with id " << resource_id;
|
| + NOTREACHED(); // Want to assert in debug mode.
|
| + return *GetEmptyImage();
|
| }
|
|
|
| - gfx::Image* image = new gfx::Image(pixbuf); // Takes ownership.
|
| - images_[key] = image;
|
| - return *image;
|
| + image = new gfx::Image(pixbuf); // Takes ownership.
|
| }
|
|
|
| - LOG(WARNING) << "Unable to pixbuf with id " << resource_id;
|
| - NOTREACHED(); // Want to assert in debug mode.
|
| - return *GetEmptyImage();
|
| + base::AutoLock lock_scope(*images_and_fonts_lock_);
|
| +
|
| + // Another thread raced the load and has already cached the image.
|
| + if (images_.count(key)) {
|
| + delete image;
|
| + return *images_[key];
|
| + }
|
| +
|
| + images_[key] = image;
|
| + return *image;
|
| }
|
|
|
| } // namespace ui
|
|
|