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

Side by Side Diff: net/filter/filter_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: Address comments Created 4 years, 8 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 #ifndef NET_FILTER_FILTER_STREAM_SOURCE_H
6 #define NET_FILTER_FILTER_STREAM_SOURCE_H
7
8 #include <memory>
9
10 #include "net/base/net_errors.h"
11 #include "net/filter/stream_source.h"
12
13 namespace net {
14
15 class IOBuffer;
16
17 class FilterStreamSource : public StreamSource {
Randy Smith (Not in Mondays) 2016/04/26 21:54:01 nit: comment as to use.
xunjieli 2016/07/20 21:00:47 Done.
18 public:
19 FilterStreamSource(SourceType type, std::unique_ptr<StreamSource> previous);
mmenke 2016/04/29 19:10:54 Hrm...Wonder about "next" vs "previous". We could
xunjieli 2016/07/20 21:00:47 Done. I have added a comment. I think |previous| i
20
21 ~FilterStreamSource() override;
22
23 net::Error Read(IOBuffer* dest_buffer,
24 size_t buffer_size,
25 size_t* bytes_read,
26 const OnReadCompleteCallback& callback) override;
27
28 // Subclass override this method to perform any initialization that needs to
29 // be completed before Read() can be called. Returns whether initialization
30 // has succeeded. If failed, filter chain will not be used.
31 virtual bool Init();
32
33 private:
34 // Asynchronous callback used in previous_->Read().
35 void OnReadComplete(const OnReadCompleteCallback& callback,
36 IOBuffer* dest_buffer,
37 size_t dest_buffer_size,
38 Error error,
39 size_t bytes_read);
40
41 // Also see Read(). Subclasses should implement this method to read data into
42 // |dest_buffer| until more input is needed from |previous_|.
43 // This method must complete synchronously (i.e. It cannot return
44 // ERR_IO_PENDING).
45 virtual net::Error ReadInternal(IOBuffer* dest_buffer,
Randy Smith (Not in Mondays) 2016/04/26 21:54:01 I think this would be cleaner if it took an input
xunjieli 2016/07/20 21:00:47 Done.
46 size_t buffer_size,
47 size_t* bytes_read) = 0;
mmenke 2016/04/29 19:10:54 DISALLOW_COPY_AND_ASSIGN
xunjieli 2016/07/20 21:00:47 Done.
48 };
49
50 } // namespace net
51
52 #endif // NET_FILTER_FILTER_STREAM_SOURCE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698