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

Unified Diff: include/core/SkPicture.h

Issue 748803005: SkPicture::SnapshotArray doesn't really stand to benefit from refcounting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | src/core/SkPicture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPicture.h
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index d5c07a37d3e717a0ffe400fc2f51b9cffc4a63a8..4db64bf93d80ff594effa0a0a156300a6bebf108 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -199,8 +199,9 @@ public:
*/
bool hasText() const;
- // A refcounted array of refcounted const SkPicture pointers.
- struct SnapshotArray : public SkNVRefCnt<SnapshotArray> {
+ // An array of refcounted const SkPicture pointers.
+ class SnapshotArray : ::SkNoncopyable {
+ public:
SnapshotArray(const SkPicture* pics[], size_t count) : fPics(pics), fCount(count) {}
~SnapshotArray() { for (size_t i = 0; i < fCount; i++) { fPics[i]->unref(); } }
@@ -263,7 +264,7 @@ private:
void createHeader(SkPictInfo* info) const;
static bool IsValidPictInfo(const SkPictInfo& info);
- // Takes ownership of the SkRecord, refs the (optional) SnapshotArray and BBH.
+ // Takes ownership of the SkRecord and (optional) SnapshotArray, refs the (optional) BBH.
SkPicture(const SkRect& cullRect, SkRecord*, SnapshotArray*, SkBBoxHierarchy*);
static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
@@ -277,7 +278,7 @@ private:
mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are refed
SkAutoTDelete<const SkRecord> fRecord;
SkAutoTUnref<const SkBBoxHierarchy> fBBH;
- SkAutoTUnref<const SnapshotArray> fDrawablePicts;
+ SkAutoTDelete<const SnapshotArray> fDrawablePicts;
// helpers for fDrawablePicts
int drawableCount() const;
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698