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

Side by Side Diff: net/quic/quic_stream_sequencer_buffer_interface.h

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 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
« no previous file with comments | « net/quic/quic_stream_sequencer_buffer.cc ('k') | net/quic/quic_stream_sequencer_buffer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_INTERFACE_H_
6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_INTERFACE_H_
7
8 #include <stddef.h>
9
10 #include "net/quic/quic_protocol.h"
11
12 namespace net {
13
14 // The QuicStreamSequencer uses an implementation of this interface to store
15 // received data.
16 class NET_EXPORT_PRIVATE QuicStreamSequencerBufferInterface {
17 public:
18 virtual ~QuicStreamSequencerBufferInterface() {}
19
20 // Free the space used to buffer data.
21 virtual void Clear() = 0;
22
23 // Returns true if there is nothing to read in this buffer.
24 virtual bool Empty() const = 0;
25
26 // Called to buffer new data received for this stream. If the data was
27 // successfully buffered, returns QUIC_NO_ERROR and stores the number of
28 // bytes buffered in |bytes_buffered|. Returns an error otherwise.
29 // |timestamp| is the time the data arrived.
30 virtual QuicErrorCode OnStreamData(QuicStreamOffset offset,
31 base::StringPiece data,
32 QuicTime timestamp,
33 size_t* bytes_buffered) = 0;
34
35 // Reads from this buffer into given iovec array, up to number of iov_len
36 // iovec objects and returns the number of bytes read.
37 virtual size_t Readv(const struct iovec* iov, size_t iov_len) = 0;
38
39 // Returns the readable region of valid data in iovec format. The readable
40 // region is the buffer region where there is valid data not yet read by
41 // client.
42 // Returns the number of iovec entries in |iov| which were populated.
43 // If the region is empty, one iovec entry with 0 length
44 // is returned, and the function returns 0. If there are more readable
45 // regions than iov_size, the function only processes the first
46 // iov_size of them.
47 virtual int GetReadableRegions(struct iovec* iov, int iov_len) const = 0;
48
49 // Fills in one iovec with data which all arrived at the same time from the
50 // next readable region.
51 // Populates |timestamp| with the time that this data arrived.
52 // Returns false if there is no readable region available.
53 virtual bool GetReadableRegion(iovec* iov, QuicTime* timestamp) const = 0;
54
55 // Called after GetReadableRegions() to free up |bytes_used| space if these
56 // bytes are processed.
57 // Pre-requisite: bytes_used <= available bytes to read.
58 virtual bool MarkConsumed(size_t bytes_used) = 0;
59
60 // Deletes and records as consumed any buffered data and clear the buffer.
61 // (To be called only after sequencer's StopReading has been called.)
62 virtual size_t FlushBufferedFrames() = 0;
63
64 // Whether there are bytes can be read out.
65 virtual bool HasBytesToRead() const = 0;
66
67 // Count how many bytes have been consumed (read out of buffer).
68 virtual QuicStreamOffset BytesConsumed() const = 0;
69
70 // Count how many bytes are in buffer at this moment.
71 virtual size_t BytesBuffered() const = 0;
72 };
73
74 } // namespace net
75
76 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_INTERFACE_H_
OLDNEW
« no previous file with comments | « net/quic/quic_stream_sequencer_buffer.cc ('k') | net/quic/quic_stream_sequencer_buffer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698