| 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  private: | 
|  | 22   // Reported in UMA and must be kept in sync with the histograms.xml file. | 
|  | 23   enum class DecodingStatus : int { | 
|  | 24     DECODING_IN_PROGRESS = 0, | 
|  | 25     DECODING_DONE, | 
|  | 26     DECODING_ERROR, | 
|  | 27 | 
|  | 28     DECODING_STATUS_COUNT | 
|  | 29     // DECODING_STATUS_COUNT must always be the last element in this enum. | 
|  | 30   }; | 
|  | 31   // StreamSource implementation | 
|  | 32   net::Error ReadInternal(IOBuffer* dest_buffer, | 
|  | 33                           size_t buffer_size, | 
|  | 34                           size_t* bytes_read) override; | 
|  | 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   DecodingStatus decoding_status_; | 
|  | 44 | 
|  | 45   size_t used_memory_; | 
|  | 46   size_t used_memory_maximum_; | 
|  | 47   size_t produced_bytes_; | 
|  | 48   size_t consumed_bytes_; | 
|  | 49 | 
|  | 50   DISALLOW_COPY_AND_ASSIGN(BrotliStreamSource); | 
|  | 51 }; | 
|  | 52 | 
|  | 53 #endif  // NET_FILTER_BROTLI_STREAM_SOURCE_H__ | 
|  | 54 }  // namespace net | 
| OLD | NEW | 
|---|