| Index: net/filter/brotli_stream_source.h
|
| diff --git a/net/filter/brotli_stream_source.h b/net/filter/brotli_stream_source.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d9b67ffb21111e57652a512528c4fa1b74d3ba14
|
| --- /dev/null
|
| +++ b/net/filter/brotli_stream_source.h
|
| @@ -0,0 +1,55 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "net/filter/stream_source.h"
|
| +#include "third_party/brotli/dec/decode.h"
|
| +
|
| +#ifndef NET_FILTER_BROTLI_STREAM_SOURCE_H__
|
| +#define NET_FILTER_BROTLI_STREAM_SOURCE_H__
|
| +namespace net {
|
| +
|
| +class BlockBuffer;
|
| +
|
| +class BrotliStreamSource : public StreamSource {
|
| + public:
|
| + BrotliStreamSource(scoped_ptr<StreamSource> previous);
|
| + ~BrotliStreamSource() override;
|
| +
|
| + // StreamSource implementation
|
| + net::Error Read(IOBuffer* dest_buffer,
|
| + size_t buffer_size,
|
| + size_t* bytes_read,
|
| + const OnReadCompleteCallback& callback) override;
|
| + size_t GetBytesOutput() const override;
|
| +
|
| + private:
|
| + void OnReadComplete(const OnReadCompleteCallback& callback,
|
| + IOBuffer* dest_buffer,
|
| + size_t dest_buffer_size,
|
| + Error error,
|
| + size_t bytes_read);
|
| +
|
| + static void* AllocateMemory(void* opaque, size_t size);
|
| + static void FreeMemory(void* opaque, void* address);
|
| + void* AllocateMemoryInternal(size_t size);
|
| +
|
| + void FreeMemoryInternal(void* address);
|
| +
|
| + BrotliState* brotli_state_;
|
| +
|
| + scoped_refptr<IOBuffer> pending_read_buffer_;
|
| + scoped_ptr<BlockBuffer> buffer_;
|
| + scoped_ptr<StreamSource> previous_;
|
| +
|
| + size_t used_memory_;
|
| + size_t used_memory_maximum_;
|
| + size_t produced_bytes_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BrotliStreamSource);
|
| +};
|
| +
|
| +#endif // NET_FILTER_BROTLI_STREAM_SOURCE_H__
|
| +} // namespace net
|
|
|