| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "net/filter/stream_source.h" |
| 8 #include "third_party/brotli/dec/decode.h" |
| 9 |
| 10 #ifndef NET_FILTER_BROTLI_STREAM_SOURCE_H__ |
| 11 #define NET_FILTER_BROTLI_STREAM_SOURCE_H__ |
| 12 namespace net { |
| 13 |
| 14 class BlockBuffer; |
| 15 |
| 16 class BrotliStreamSource : public StreamSource { |
| 17 public: |
| 18 BrotliStreamSource(scoped_ptr<StreamSource> previous); |
| 19 ~BrotliStreamSource() override; |
| 20 |
| 21 // StreamSource implementation |
| 22 net::Error Read(IOBuffer* dest_buffer, |
| 23 size_t buffer_size, |
| 24 size_t* bytes_read, |
| 25 const OnReadCompleteCallback& callback) override; |
| 26 size_t GetBytesOutput() const override; |
| 27 |
| 28 private: |
| 29 void OnReadComplete(const OnReadCompleteCallback& callback, |
| 30 IOBuffer* dest_buffer, |
| 31 size_t dest_buffer_size, |
| 32 Error error, |
| 33 size_t bytes_read); |
| 34 |
| 35 static void* AllocateMemory(void* opaque, size_t size); |
| 36 static void FreeMemory(void* opaque, void* address); |
| 37 void* AllocateMemoryInternal(size_t size); |
| 38 |
| 39 void FreeMemoryInternal(void* address); |
| 40 |
| 41 BrotliState* brotli_state_; |
| 42 |
| 43 scoped_refptr<IOBuffer> pending_read_buffer_; |
| 44 scoped_ptr<BlockBuffer> buffer_; |
| 45 scoped_ptr<StreamSource> previous_; |
| 46 |
| 47 size_t used_memory_; |
| 48 size_t used_memory_maximum_; |
| 49 size_t produced_bytes_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(BrotliStreamSource); |
| 52 }; |
| 53 |
| 54 #endif // NET_FILTER_BROTLI_STREAM_SOURCE_H__ |
| 55 } // namespace net |
| OLD | NEW |