aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-31 13:17:31 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-31 13:17:31 +0000
commita1da1034318774e529abadc126e9d3c74da7b67c (patch)
treed5e26893bc03f03656634f71f93c437fc25e7fd8 /include/core
parent2d537a18f49cb492358c2b051f4786075dd9406c (diff)
Update SkData and SkDataSet to make better use of SkFlattenable.
TEST=DataRefTest.cpp Review URL: https://codereview.appspot.com/6441076 git-svn-id: http://skia.googlecode.com/svn/trunk@4850 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkData.h12
-rw-r--r--include/core/SkDataSet.h17
2 files changed, 19 insertions, 10 deletions
diff --git a/include/core/SkData.h b/include/core/SkData.h
index 0c8e187b64..e371931a3c 100644
--- a/include/core/SkData.h
+++ b/include/core/SkData.h
@@ -11,14 +11,14 @@
#ifndef SkData_DEFINED
#define SkData_DEFINED
-#include "SkRefCnt.h"
+#include "SkFlattenable.h"
/**
* SkData holds an immutable data buffer. Not only is the data immutable,
* but the actual ptr that is returned (by data() or bytes()) is guaranteed
* to always be the same for the life of this instance.
*/
-class SK_API SkData : public SkRefCnt {
+class SK_API SkData : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkData)
@@ -100,6 +100,12 @@ public:
*/
static SkData* NewEmpty();
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkData)
+
+protected:
+ SkData(SkFlattenableReadBuffer&);
+ virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+
private:
ReleaseProc fReleaseProc;
void* fReleaseProcContext;
@@ -117,7 +123,7 @@ private:
// access to the destructor.
friend class SkAutoTUnref<SkData>::BlockRef<SkData>;
- typedef SkRefCnt INHERITED;
+ typedef SkFlattenable INHERITED;
};
/**
diff --git a/include/core/SkDataSet.h b/include/core/SkDataSet.h
index 781cd6ced6..734c3c32c2 100644
--- a/include/core/SkDataSet.h
+++ b/include/core/SkDataSet.h
@@ -8,20 +8,18 @@
#ifndef SkDataSet_DEFINED
#define SkDataSet_DEFINED
-#include "SkRefCnt.h"
#include "SkData.h"
+#include "SkFlattenable.h"
class SkStream;
class SkWStream;
-class SkFlattenableReadBuffer;
-class SkFlattenableWriteBuffer;
-class SkDataSet : public SkRefCnt {
+class SkDataSet : public SkFlattenable {
public:
/**
* Returns a new empty dataset. Note: since SkDataSet is immutable, this
* "new" set may be the same one that was returned before, but each
- * returned object must have its reference-count balanced regardles.
+ * returned object must have its reference-count balanced regardless.
*
* SkDataSet* empty = SkDataSet::NewEmpty();
* ...
@@ -73,13 +71,18 @@ public:
explicit SkDataSet(SkStream*);
void writeToStream(SkWStream*) const;
- explicit SkDataSet(SkFlattenableReadBuffer&);
- void flatten(SkFlattenableWriteBuffer&) const;
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDataSet)
+
+protected:
+ SkDataSet(SkFlattenableReadBuffer&);
+ virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
private:
int32_t fCount;
uint32_t fKeySize;
Pair* fPairs;
+
+ typedef SkFlattenable INHERITED;
};
#endif