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

Unified Diff: ui/gfx/image/image.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/image/image.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image.cc
diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc
index d7c67ccd65a7274d3ce6865aba7e4284d5c22b8c..e3bcefcea217b644f8d2dda379b99cce31f89bce 100644
--- a/ui/gfx/image/image.cc
+++ b/ui/gfx/image/image.cc
@@ -420,10 +420,15 @@ Image::Image(const ImageSkia& image) {
}
#if defined(OS_IOS)
-Image::Image(UIImage* image)
+Image::Image(UIImage* image) : Image(image, base::scoped_policy::ASSUME) {}
+
+Image::Image(UIImage* image, base::scoped_policy::OwnershipPolicy policy)
: storage_(new internal::ImageStorage(Image::kImageRepCocoaTouch)) {
- if (image)
+ if (image) {
+ if (policy == base::scoped_policy::RETAIN)
+ base::mac::NSObjectRetain(image);
AddRepresentation(base::MakeUnique<internal::ImageRepCocoaTouch>(image));
+ }
}
#elif defined(OS_MACOSX)
Image::Image(NSImage* image) {
« no previous file with comments | « ui/gfx/image/image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698