1 // Copyright (c) 2013 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.
5 #ifndef NET_SPDY_SPDY_BUFFER_QUEUE_H_
6 #define NET_SPDY_SPDY_BUFFER_QUEUE_H_
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "net/base/net_export.h"
19 // A FIFO queue of incoming data from a SPDY connection. Useful for
20 // SpdyStream delegates.
21 class NET_EXPORT_PRIVATE SpdyReadQueue
{
26 // Returns whether there's anything in the queue.
29 // Returns the total number of bytes in the queue.
30 size_t GetTotalSize() const;
32 // Enqueues the bytes in |buffer|.
33 void Enqueue(scoped_ptr
<SpdyBuffer
> buffer
);
35 // Dequeues up to |len| (which must be positive) bytes into
36 // |out|. Returns the number of bytes dequeued.
37 size_t Dequeue(char* out
, size_t len
);
39 // Removes all bytes from the queue.
43 std::deque
<SpdyBuffer
*> queue_
;
46 DISALLOW_COPY_AND_ASSIGN(SpdyReadQueue
);
51 #endif // NET_SPDY_SPDY_BUFFER_QUEUE_H_