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

Side by Side Diff: ui/base/resource/resource_bundle_ios.mm

Issue 2504683002: Adds a new constructor for gfx::Image on iOS. (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/suggestions/ios_image_decoder_impl.mm ('k') | ui/gfx/image/image.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/resource/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 orientation:UIImageOrientationUp]); 156 orientation:UIImageOrientationUp]);
157 } 157 }
158 158
159 if (!ui_image.get()) { 159 if (!ui_image.get()) {
160 LOG(WARNING) << "Unable to load image with id " << resource_id; 160 LOG(WARNING) << "Unable to load image with id " << resource_id;
161 NOTREACHED(); // Want to assert in debug mode. 161 NOTREACHED(); // Want to assert in debug mode.
162 return GetEmptyImage(); 162 return GetEmptyImage();
163 } 163 }
164 164
165 // The gfx::Image takes ownership. 165 // The gfx::Image takes ownership.
166 image = gfx::Image(ui_image.release()); 166 image = gfx::Image(ui_image, base::scoped_policy::RETAIN);
167 } 167 }
168 168
169 base::AutoLock lock(*images_and_fonts_lock_); 169 base::AutoLock lock(*images_and_fonts_lock_);
170 170
171 // Another thread raced the load and has already cached the image. 171 // Another thread raced the load and has already cached the image.
172 if (images_.count(resource_id)) 172 if (images_.count(resource_id))
173 return images_[resource_id]; 173 return images_[resource_id];
174 174
175 images_[resource_id] = image; 175 images_[resource_id] = image;
176 return images_[resource_id]; 176 return images_[resource_id];
177 } 177 }
178 178
179 } // namespace ui 179 } // namespace ui
OLDNEW
« no previous file with comments | « ios/chrome/browser/suggestions/ios_image_decoder_impl.mm ('k') | ui/gfx/image/image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698