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

Unified Diff: include/core/SkWriter32.h

Issue 19564007: Start from scratch on a faster SkFlatDictionary. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix memory overwrite and tests Created 7 years, 5 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 | « no previous file | src/core/SkOrderedWriteBuffer.h » ('j') | src/core/SkPictureFlat.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkWriter32.h
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h
index 51044ab00ea0e3faa6387121b98dcf87067e7dfe..01e32f96d6f8e861f691c3bd7d4976009414912a 100644
--- a/include/core/SkWriter32.h
+++ b/include/core/SkWriter32.h
@@ -49,7 +49,14 @@ public:
// DEPRECATED: use byetsWritten instead
tomhudson 2013/07/22 16:36:02 Tangent: in SkFlatDictionary, byets write you!
mtklein 2013/07/22 17:43:56 :) Fxied
uint32_t size() const { return this->bytesWritten(); }
- void reset();
+ // Returns true if we've written only into the storage passed into constructor or reset.
+ // (You may be able to use this to avoid a call to flatten.)
+ bool wroteOnlyToStorage() const {
+ return fHead == &fExternalBlock && this->bytesWritten() <= fExternalBlock.fSizeOfBlock;
+ }
+
+ void reset();
+ void reset(void* storage, size_t size);
tomhudson 2013/07/22 16:36:02 Thanks for moving these together.
// size MUST be multiple of 4
uint32_t* reserve(size_t size) {
@@ -63,8 +70,6 @@ public:
return block->alloc(size);
}
- void reset(void* storage, size_t size);
-
bool writeBool(bool value) {
this->writeInt(value);
return value;
« no previous file with comments | « no previous file | src/core/SkOrderedWriteBuffer.h » ('j') | src/core/SkPictureFlat.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698