author Wes Kocher <>
Wed, 10 May 2017 10:01:18 -0700
changeset 407965 ce2218406119c36a551e3faea4e192186ee46cc5
parent 407937 af6f19870b2a00759ac1d83dedc3db57213abfee
child 408167 0ded74baeaf23d7985401fe9bbabdb3d9385ac22
permissions -rw-r--r--
Backed out 9 changesets (bug 1340627) for graphical glitches a=backout Backed out changeset 0b1371055c7f (bug 1340627) Backed out changeset f152be1fadb7 (bug 1340627) Backed out changeset c691e2ab6a0c (bug 1340627) Backed out changeset 3cb4bceb8d79 (bug 1340627) Backed out changeset 026aadd76d06 (bug 1340627) Backed out changeset fdbd5d281287 (bug 1340627) Backed out changeset 75fb0d9858a9 (bug 1340627) Backed out changeset 0d4ec7d38a00 (bug 1340627) Backed out changeset af6f19870b2a (bug 1340627) MozReview-Commit-ID: 9dHr7xMZezY

 * Copyright 2013 Google Inc.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.

#include "SkTypes.h"

class SkStream;
class SkStreamRewindable;

 *  Specialized stream that buffers the first X bytes of a stream,
 *  where X is passed in by the user. Note that unlike some buffered
 *  stream APIs, once more bytes than can fit in the buffer are read,
 *  no more buffering is done. This stream is designed for a use case
 *  where the caller knows that rewind will only be called from within
 *  X bytes (inclusive), and the wrapped stream is not necessarily
 *  able to rewind at all.
class SkFrontBufferedStream {
     *  Creates a new stream that wraps and buffers an SkStream.
     *  @param stream SkStream to buffer. If stream is NULL, NULL is
     *      returned. When this call succeeds (i.e. returns non NULL),
     *      SkFrontBufferedStream is expected to be the only owner of
     *      stream, so it should no be longer used directly.
     *      SkFrontBufferedStream will delete stream upon deletion.
     *  @param minBufferSize Minimum size of buffer required.
     *  @return An SkStream that can buffer at least minBufferSize, or
     *      NULL on failure. The caller is required to delete when finished with
     *      this object.
    static SkStreamRewindable* Create(SkStream* stream, size_t minBufferSize);