Index: include/core/SkRWBuffer.h |
diff --git a/include/core/SkRWBuffer.h b/include/core/SkRWBuffer.h |
index 106e572587d8dcaa13d84e792bef40444e207696..7cf0b9b82c203bac09a4dd7db7d1461a5601393e 100644 |
--- a/include/core/SkRWBuffer.h |
+++ b/include/core/SkRWBuffer.h |
@@ -53,22 +53,30 @@ public: |
private: |
const SkBufferBlock* fBlock; |
size_t fRemaining; |
+ const SkROBuffer* fBuffer; |
scroggo
2016/04/08 16:15:28
SkROBuffer is a const class, so should I remove th
|
}; |
private: |
- SkROBuffer(const SkBufferHead* head, size_t used); |
+ SkROBuffer(const SkBufferHead* head, size_t used, const SkBufferBlock* tail); |
virtual ~SkROBuffer(); |
- const SkBufferHead* fHead; |
- const size_t fUsed; |
+ const SkBufferHead* fHead; |
+ const size_t fUsed; |
+ |
+ // Final block that existed when this object was created. It is the only block that may |
+ // have more bytes in it than this object knows about. Store its fUsed amount at creation |
+ // time, so it can be read later without racing with a writer updating it. |
+ const SkBufferBlock* fTail; |
+ const size_t fTailUsed; |
scroggo
2016/04/08 16:15:29
I'm not a huge fan of this name, but I don't have
|
friend class SkRWBuffer; |
}; |
/** |
* Accumulates bytes of memory that are "appended" to it, growing internal storage as needed. |
- * The growth is done such that at any time, a RBuffer or StreamAsset can be snapped off, which |
- * can see the previously stored bytes, but which will be unaware of any future writes. |
+ * The growth is done such that at any time in the writer's thread, an RBuffer or StreamAsset |
+ * can be snapped off (and safely passed to another thread). The RBuffer/StreamAsset snapshot |
+ * can see the previously stored bytes, but will be unaware of any future writes. |
*/ |
class SK_API SkRWBuffer { |
public: |