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

Unified Diff: src/core/SkPicture.cpp

Issue 163053005: Cleanup unref and null (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months 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: src/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index e226c2642ac1e0d4a6ad23a8ce4a218795937c06..7762939c5d512a22b15e2e130086867f0f325e2b 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -164,12 +164,7 @@ void SkPicture::clone(SkPicture* pictures, int count) const {
clone->fWidth = fWidth;
clone->fHeight = fHeight;
- clone->fRecord = NULL;
-
- if (NULL != clone->fRecord) {
- clone->fRecord->unref();
- clone->fRecord = NULL;
- }
+ SkSafeSetNull(clone->fRecord);
scroggo 2014/02/14 15:07:40 SkSafeSetNull seems like a bad name to me - it's n
SkDELETE(clone->fPlayback);
/* We want to copy the src's playback. However, if that hasn't been built
@@ -196,10 +191,7 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
fPlayback = NULL;
}
- if (NULL != fRecord) {
- fRecord->unref();
- fRecord = NULL;
- }
+ SkSafeSetNull(fRecord);
SkBitmap bm;
bm.setConfig(SkBitmap::kNo_Config, width, height);
@@ -246,8 +238,7 @@ void SkPicture::endRecording() {
if (NULL != fRecord) {
fRecord->endRecording();
fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
- fRecord->unref();
- fRecord = NULL;
+ SkSafeSetNull(fRecord);
}
}
SkASSERT(NULL == fRecord);
« 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