Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: net/filter/brotli_stream_source.h

Issue 1662763002: [ON HOLD] Implement pull-based design for content decoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698