skia2/include/utils/SkFrontBufferedStream.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

40 lines
1.6 KiB
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkFrontBufferedStream_DEFINED
#define SkFrontBufferedStream_DEFINED
#include "include/core/SkStream.h"
/**
* 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 SK_API SkFrontBufferedStream {
public:
/**
* 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 std::unique_ptr<SkStreamRewindable> Make(std::unique_ptr<SkStream> stream,
size_t minBufferSize);
};
#endif // SkFrontBufferedStream_DEFINED