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

Unified Diff: printing/metafile_skia_wrapper.cc

Issue 11316263: printing: Use skia::RefPtr to replace manual ref-counting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/metafile_skia_wrapper.cc
diff --git a/printing/metafile_skia_wrapper.cc b/printing/metafile_skia_wrapper.cc
index d4634ef421c42f21b8f7574d6de2a172cc796953..2fddc004e12512016e478c27d9a6d936ea0c3398 100644
--- a/printing/metafile_skia_wrapper.cc
+++ b/printing/metafile_skia_wrapper.cc
@@ -4,6 +4,7 @@
#include "printing/metafile_skia_wrapper.h"
#include "skia/ext/platform_device.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkMetaData.h"
@@ -20,13 +21,12 @@ const char* kCustomScaleKey = "CrCustomScale";
// static
void MetafileSkiaWrapper::SetMetafileOnCanvas(const SkCanvas& canvas,
Metafile* metafile) {
- MetafileSkiaWrapper* wrapper = NULL;
+ skia::RefPtr<MetafileSkiaWrapper> wrapper;
if (metafile)
- wrapper = new MetafileSkiaWrapper(metafile);
+ wrapper = skia::AdoptRef(new MetafileSkiaWrapper(metafile));
SkMetaData& meta = skia::getMetaData(canvas);
- meta.setRefCnt(kMetafileKey, wrapper);
- SkSafeUnref(wrapper);
+ meta.setRefCnt(kMetafileKey, wrapper.get());
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698