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

Unified Diff: src/core/SkFlattenableSerialization.cpp

Issue 560653004: SkData can allocate room for its contents in the same block (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox, change fPtr to non const Created 6 years, 3 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 | « src/core/SkData.cpp ('k') | src/core/SkStream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFlattenableSerialization.cpp
diff --git a/src/core/SkFlattenableSerialization.cpp b/src/core/SkFlattenableSerialization.cpp
index b33bca6dbbe47c9a0fb15ed71289abb1f943a035..31602079a39b995897d906c8996b726a92478b42 100644
--- a/src/core/SkFlattenableSerialization.cpp
+++ b/src/core/SkFlattenableSerialization.cpp
@@ -15,9 +15,9 @@ SkData* SkValidatingSerializeFlattenable(SkFlattenable* flattenable) {
SkWriteBuffer writer(SkWriteBuffer::kValidation_Flag);
writer.writeFlattenable(flattenable);
size_t size = writer.bytesWritten();
- void* data = sk_malloc_throw(size);
- writer.writeToMemory(data);
- return SkData::NewFromMalloc(data, size);
+ SkData* data = SkData::NewUninitialized(size);
+ writer.writeToMemory(data->writable_data());
+ return data;
}
SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size,
« no previous file with comments | « src/core/SkData.cpp ('k') | src/core/SkStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698