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

Side by Side Diff: net/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: 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 #ifndef NET_FILTER_STREAM_SOURCE_H
6 #define NET_FILTER_STREAM_SOURCE_H
7
8 #include "base/callback.h"
9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h"
11
12 namespace net {
13
14 class SdchStreamSourceDelegate;
15
16 // The StreamSource class implements a producer of bytes. Sources often
17 // incorporate a previous source from which they read undecoded input. Those
18 // which incorporate a previous source take ownership of the previous source
19 // when they are created.
20 class StreamSource {
21 public:
22 virtual ~StreamSource(){};
mmenke 2016/02/18 22:58:28 Remove semi-colon
xunjieli 2016/03/03 23:00:09 Done.
23 typedef base::Callback<void(net::Error, size_t)> OnReadCompleteCallback;
24
25 // Reads bytes from this source. This method can either complete synchronously
26 // or asynchronously. If it completes synchronously, it:
27 // - Returns an Error other than ERR_IO_PENDING
28 // - Writes |*bytes_read| with the count of bytes read
29 // - Writes bytes into |*dest_buffer|
30 // - Does not call |callback|
31 // If it completes asynchronously, it:
32 // - Returns ERR_IO_PENDING
33 // - Does not write |*bytes_read|
34 // - Calls |callback| when it does complete, with an error code and a count
35 // of bytes read, which are them placed into |*dest_buffer|.
36 // This method takes a reference to |*dest_buffer| if it completes
37 // asynchronously to ensure it does not get freed mid-read.
38 virtual net::Error Read(IOBuffer* dest_buffer,
39 size_t buffer_size,
40 size_t* bytes_read,
41 const OnReadCompleteCallback& callback) = 0;
42
43 // Returns how many bytes total have been returned by Read() of |this|.
44 virtual size_t GetBytesOutput() const = 0;
mmenke 2016/02/18 22:58:28 Is this method really needed? Can't the URLReques
45
46 // This method constructs a chain of StreamSources from a vector of
47 // Content-Type values and an SdchStreamSourceDelegate. If any of the
48 // constructed
49 // StreamSources are SdchStreamSources, they will be constructed with
50 // |delegate|.
51 static scoped_ptr<StreamSource> BuildSourceChain(
52 scoped_ptr<StreamSource> previous,
53 const std::vector<std::string>& type,
54 SdchStreamSourceDelegate* delegate);
55 };
56
57 } // namespace net
58
59 #endif // NET_FILTER_STREAM_SOURCE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698