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

Unified Diff: src/core/SkData.cpp

Issue 26928002: SkData need not be a Flattenable, since it does not need subclass/factories (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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
Index: src/core/SkData.cpp
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index a1b42b0c4f971b08a17f411b0af4a943b5b926c9..f5d983e0edee311638debc02e4112c5527e8d91d 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -158,28 +158,6 @@ SkData* SkData::NewWithCString(const char cstr[]) {
///////////////////////////////////////////////////////////////////////////////
-void SkData::flatten(SkFlattenableWriteBuffer& buffer) const {
- buffer.writeByteArray(fPtr, fSize);
-}
-
-SkData::SkData(SkFlattenableReadBuffer& buffer) {
- fSize = buffer.getArrayCount();
- fReleaseProcContext = NULL;
-
- if (fSize > 0) {
- fPtr = sk_malloc_throw(fSize);
- fReleaseProc = sk_free_releaseproc;
- } else {
- fPtr = NULL;
- fReleaseProc = NULL;
- }
-
- buffer.readByteArray(const_cast<void*>(fPtr));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
#include "SkDataSet.h"
#include "SkFlattenable.h"
#include "SkStream.h"
@@ -283,7 +261,7 @@ void SkDataSet::flatten(SkFlattenableWriteBuffer& buffer) const {
if (fCount > 0) {
buffer.writeByteArray(fPairs[0].fKey, fKeySize);
for (int i = 0; i < fCount; ++i) {
- buffer.writeFlattenable(fPairs[i].fValue);
+ buffer.writeDataAsByteArray(fPairs[i].fValue);
}
}
}
@@ -320,7 +298,7 @@ SkDataSet::SkDataSet(SkFlattenableReadBuffer& buffer) {
for (int i = 0; i < fCount; ++i) {
fPairs[i].fKey = keyStorage;
keyStorage += strlen(keyStorage) + 1;
- fPairs[i].fValue = buffer.readFlattenableT<SkData>();
+ fPairs[i].fValue = buffer.readByteArrayAsData();
}
} else {
fKeySize = 0;

Powered by Google App Engine
This is Rietveld 408576698