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

Unified Diff: src/core/SkRWBuffer.h

Issue 1838463003: Move SkRWBuffer.h to include/ and add SK_API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « include/core/SkRWBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRWBuffer.h
diff --git a/src/core/SkRWBuffer.h b/src/core/SkRWBuffer.h
deleted file mode 100644
index 9d88a60203f6842c5ec213acd1640abe4f7d1a0b..0000000000000000000000000000000000000000
--- a/src/core/SkRWBuffer.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkRWBuffer_DEFINED
-#define SkRWBuffer_DEFINED
-
-#include "SkRefCnt.h"
-
-struct SkBufferBlock;
-struct SkBufferHead;
-class SkRWBuffer;
-class SkStreamAsset;
-
-/**
- * Contains a read-only, thread-sharable block of memory. To access the memory, the caller must
- * instantiate a local iterator, as the memory is stored in 1 or more contiguous blocks.
- */
-class SkROBuffer : public SkRefCnt {
-public:
- /**
- * Return the logical length of the data owned/shared by this buffer. It may be stored in
- * multiple contiguous blocks, accessible via the iterator.
- */
- size_t size() const { return fUsed; }
-
- class Iter {
- public:
- Iter(const SkROBuffer*);
-
- void reset(const SkROBuffer*);
-
- /**
- * Return the current continuous block of memory, or nullptr if the iterator is exhausted
- */
- const void* data() const;
-
- /**
- * Returns the number of bytes in the current continguous block of memory, or 0 if the
- * iterator is exhausted.
- */
- size_t size() const;
-
- /**
- * Advance to the next contiguous block of memory, returning true if there is another
- * block, or false if the iterator is exhausted.
- */
- bool next();
-
- private:
- const SkBufferBlock* fBlock;
- size_t fRemaining;
- };
-
-private:
- SkROBuffer(const SkBufferHead* head, size_t used);
- virtual ~SkROBuffer();
-
- const SkBufferHead* fHead;
- const size_t fUsed;
-
- 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.
- */
-class SkRWBuffer {
-public:
- SkRWBuffer(size_t initialCapacity = 0);
- ~SkRWBuffer();
-
- size_t size() const { return fTotalUsed; }
- void append(const void* buffer, size_t length);
- void* append(size_t length);
-
- SkROBuffer* newRBufferSnapshot() const;
- SkStreamAsset* newStreamSnapshot() const;
-
-#ifdef SK_DEBUG
- void validate() const;
-#else
- void validate() const {}
-#endif
-
-private:
- SkBufferHead* fHead;
- SkBufferBlock* fTail;
- size_t fTotalUsed;
-};
-
-#endif
« no previous file with comments | « include/core/SkRWBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698