Add SkNVRefCnt, prune down SkPicture's size
SkNVRefCnt is a variant of SkRefCnt that's Not Virtual, so weighs 4 bytes
instead of 8 or 16. There's only benefit to doing this if the deriving class
does not otherwise need a vtable, e.g. SkPicture.
I've stripped out some cruft from SkPicture, rearranged fields to pack tightly,
and added compile asserts for the sizes of SkPicture, SkRecord, and
SkVarAlloc.
BUG=skia:3144
Review URL: https://codereview.chromium.org/741793002
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index c2c19c5..ce10f56 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1503,7 +1503,7 @@
SkSetErrorCallback(assert_one_parse_error_cb, &context);
SkMemoryStream pictureStream(picture1);
SkClearLastError();
- SkAutoUnref pictureFromStream(SkPicture::CreateFromStream(&pictureStream, NULL));
+ SkAutoTUnref<SkPicture> pictureFromStream(SkPicture::CreateFromStream(&pictureStream, NULL));
REPORTER_ASSERT(reporter, pictureFromStream.get() != NULL);
SkClearLastError();
SkSetErrorCallback(NULL, NULL);
@@ -1733,7 +1733,7 @@
sizeof(SkPicture) + sizeof(SkRecord));
// Protect against any unintentional bloat.
- REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get()) <= 184);
+ REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get()) <= 144);
// Sanity check of nested SkPictures.
SkPictureRecorder r2;