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

Unified Diff: include/core/SkRWBuffer.h

Issue 2385803002: Add a SkRWBuffer reserve mechanism (Closed)
Patch Set: missed the initial allocation Created 4 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 | « no previous file | src/core/SkRWBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRWBuffer.h
diff --git a/include/core/SkRWBuffer.h b/include/core/SkRWBuffer.h
index 9626d28df9643ee836ba6a1e285ce456ec7101f0..451933f353cae3a367c57f74e239c137794aa4f1 100644
--- a/include/core/SkRWBuffer.h
+++ b/include/core/SkRWBuffer.h
@@ -79,7 +79,15 @@ public:
~SkRWBuffer();
size_t size() const { return fTotalUsed; }
- void append(const void* buffer, size_t length);
+
+ /**
+ * Append |length| bytes from |buffer|.
+ *
+ * If the caller knows in advance how much more data they are going to append, they can
+ * pass a |reserve| hint (representing the number of upcoming bytes *in addition* to the
+ * current append), to minimize the number of internal allocations.
+ */
+ void append(const void* buffer, size_t length, size_t reserve = 0);
SkROBuffer* newRBufferSnapshot() const;
SkStreamAsset* newStreamSnapshot() const;
« no previous file with comments | « no previous file | src/core/SkRWBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698