DescriptionAllow SkStream::peek() to partially succeed
If the stream can peek less than requested, peek that amount. Return
the number of bytes peeked.
This simplifies crrev.com/1472123002. For a stream that is smaller than
14 bytes, it can successfully peek, meaning the client will not need to
fall back to read() + rewind(), which may fail if the stream can peek
but not rewind.
This CL revives code from patch set 3 of crrev.com/1044953002, where I
initially introduced peek() (including tests).
Add a test for SkFrontBufferedStream that verifies that peeking does
not make rewind() fail (i.e. by reading past the internal buffer).
BUG=skia:3257
Committed: https://skia.googlesource.com/skia/+/d61c384342aaf7facf31b948db98acc32d81d21b
Patch Set 1 #
Total comments: 14
Patch Set 2 : Respond to Ben's comments in patch set 1 #
Total comments: 2
Patch Set 3 : Remove whitespace #
Total comments: 2
Patch Set 4 : Use the correct return type #
Depends on Patchset: Dependent Patchsets: Messages
Total messages: 21 (6 generated)
|