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

Unified Diff: src/utils/SkFrontBufferedStream.cpp

Issue 669813002: Add an assert that we still have a buffer to readFromBuffer(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkFrontBufferedStream.cpp
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 8cb3931082c75d268e793212a73f688a1dbe227f..9a666dcc7e9d0e8fd86aa9a11aafac996b70904d 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -119,6 +119,7 @@ size_t FrontBufferedStream::readFromBuffer(char* dst, size_t size) {
size_t FrontBufferedStream::bufferAndWriteTo(char* dst, size_t size) {
SkASSERT(size > 0);
SkASSERT(fOffset >= fBufferedSoFar);
+ SkASSERT(fBuffer);
// Data needs to be buffered. Buffer up to the lesser of the size requested
// and the remainder of the max buffer size.
const size_t bytesToBuffer = SkTMin(size, fBufferSize - fBufferedSoFar);
@@ -148,7 +149,7 @@ size_t FrontBufferedStream::readDirectlyFromStream(char* dst, size_t size) {
// If we have read past the end of the buffer, rewinding is no longer
// supported, so we can go ahead and free the memory.
if (bytesReadDirectly > 0) {
- fBuffer.reset(0);
+ sk_free(fBuffer.detach());
}
return bytesReadDirectly;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698