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

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

Issue 11361131: Pass the ImageSkia by pointer instead of by reference, which will create shallow copy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_aura Created 8 years, 1 month 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_skia.h ('k') | ui/gfx/image/image_skia_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia.cc
diff --git a/ui/gfx/image/image_skia.cc b/ui/gfx/image/image_skia.cc
index 6c73b02ef8cfa915188fefe386026a09344ed2c0..a886ab02d35b732c026e04eb5279e99475de8d33 100644
--- a/ui/gfx/image/image_skia.cc
+++ b/ui/gfx/image/image_skia.cc
@@ -223,23 +223,23 @@ ImageSkia& ImageSkia::operator=(const ImageSkia& other) {
ImageSkia::~ImageSkia() {
}
-ImageSkia ImageSkia::DeepCopy() const {
- ImageSkia copy;
+scoped_ptr<ImageSkia> ImageSkia::DeepCopy() const {
+ ImageSkia* copy = new ImageSkia;
if (isNull())
- return copy;
+ return scoped_ptr<ImageSkia>(copy);
CHECK(CanRead());
std::vector<gfx::ImageSkiaRep>& reps = storage_->image_reps();
for (std::vector<gfx::ImageSkiaRep>::iterator iter = reps.begin();
iter != reps.end(); ++iter) {
- copy.AddRepresentation(*iter);
+ copy->AddRepresentation(*iter);
}
// The copy has its own storage. Detach the copy from the current
// thread so that other thread can use this.
- if (!copy.isNull())
- copy.storage_->DetachFromThread();
- return copy;
+ if (!copy->isNull())
+ copy->storage_->DetachFromThread();
+ return scoped_ptr<ImageSkia>(copy);
}
bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const {
« no previous file with comments | « ui/gfx/image/image_skia.h ('k') | ui/gfx/image/image_skia_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698