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

Side by Side Diff: trunk/src/net/spdy/spdy_write_queue.h

Issue 13996009: Revert 194560 "[SPDY] Replace SpdyIOBuffer with new SpdyBuffer c..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SPDY_SPDY_WRITE_QUEUE_H_ 5 #ifndef NET_SPDY_SPDY_WRITE_QUEUE_H_
6 #define NET_SPDY_SPDY_WRITE_QUEUE_H_ 6 #define NET_SPDY_SPDY_WRITE_QUEUE_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/base/request_priority.h" 14 #include "net/base/request_priority.h"
15 #include "net/spdy/spdy_protocol.h" 15 #include "net/spdy/spdy_protocol.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 class SpdyBuffer; 19 class SpdyFrameProducer;
20 class SpdyBufferProducer;
21 class SpdyStream; 20 class SpdyStream;
22 21
23 // A queue of SpdyBufferProducers to produce frames to write. Ordered 22 // A queue of SpdyFrameProducers to produce frames to write. Ordered
24 // by priority, and then FIFO. 23 // by priority, and then FIFO.
25 class NET_EXPORT_PRIVATE SpdyWriteQueue { 24 class NET_EXPORT_PRIVATE SpdyWriteQueue {
26 public: 25 public:
27 SpdyWriteQueue(); 26 SpdyWriteQueue();
28 ~SpdyWriteQueue(); 27 ~SpdyWriteQueue();
29 28
30 // Enqueues the given frame producer of the given type at the given 29 // Enqueues the given frame producer of the given type at the given
31 // priority associated with the given stream, which may be NULL if 30 // priority associated with the given stream, which may be NULL if
32 // the frame producer is not associated with a stream. If |stream| 31 // the frame producer is not associated with a stream. If |stream|
33 // is non-NULL, its priority must be equal to |priority|. 32 // is non-NULL, its priority must be equal to |priority|.
34 void Enqueue(RequestPriority priority, 33 void Enqueue(RequestPriority priority,
35 SpdyFrameType frame_type, 34 SpdyFrameType frame_type,
36 scoped_ptr<SpdyBufferProducer> frame_producer, 35 scoped_ptr<SpdyFrameProducer> frame_producer,
37 const scoped_refptr<SpdyStream>& stream); 36 const scoped_refptr<SpdyStream>& stream);
38 37
39 // Dequeues the frame producer with the highest priority that was 38 // Dequeues the frame producer with the highest priority that was
40 // enqueued the earliest and its associated stream. Returns true and 39 // enqueued the earliest and its associated stream. Returns true and
41 // fills in |frame_type|, |frame_producer|, and |stream| if 40 // fills in |frame_type|, |frame_producer|, and |stream| if
42 // successful -- otherwise, just returns false. 41 // successful -- otherwise, just returns false.
43 bool Dequeue(SpdyFrameType* frame_type, 42 bool Dequeue(SpdyFrameType* frame_type,
44 scoped_ptr<SpdyBufferProducer>* frame_producer, 43 scoped_ptr<SpdyFrameProducer>* frame_producer,
45 scoped_refptr<SpdyStream>* stream); 44 scoped_refptr<SpdyStream>* stream);
46 45
47 // Removes all pending writes for the given stream, which must be 46 // Removes all pending writes for the given stream, which must be
48 // non-NULL. 47 // non-NULL.
49 void RemovePendingWritesForStream(const scoped_refptr<SpdyStream>& stream); 48 void RemovePendingWritesForStream(const scoped_refptr<SpdyStream>& stream);
50 49
51 // Removes all pending writes. 50 // Removes all pending writes.
52 void Clear(); 51 void Clear();
53 52
54 private: 53 private:
55 // A struct holding a frame producer and its associated stream. 54 // A struct holding a frame producer and its associated stream.
56 struct PendingWrite { 55 struct PendingWrite {
57 SpdyFrameType frame_type; 56 SpdyFrameType frame_type;
58 // This has to be a raw pointer since we store this in an STL 57 // This has to be a raw pointer since we store this in an STL
59 // container. 58 // container.
60 SpdyBufferProducer* frame_producer; 59 SpdyFrameProducer* frame_producer;
61 scoped_refptr<SpdyStream> stream; 60 scoped_refptr<SpdyStream> stream;
62 61
63 PendingWrite(); 62 PendingWrite();
64 PendingWrite(SpdyFrameType frame_type, 63 PendingWrite(SpdyFrameType frame_type,
65 SpdyBufferProducer* frame_producer, 64 SpdyFrameProducer* frame_producer,
66 const scoped_refptr<SpdyStream>& stream); 65 const scoped_refptr<SpdyStream>& stream);
67 ~PendingWrite(); 66 ~PendingWrite();
68 }; 67 };
69 68
70 // The actual write queue, binned by priority. 69 // The actual write queue, binned by priority.
71 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; 70 std::deque<PendingWrite> queue_[NUM_PRIORITIES];
72 71
73 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); 72 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue);
74 }; 73 };
75 74
76 } // namespace net 75 } // namespace net
77 76
78 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ 77 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_
OLDNEW
« no previous file with comments | « trunk/src/net/spdy/spdy_websocket_stream_spdy3_unittest.cc ('k') | trunk/src/net/spdy/spdy_write_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698