OLD | NEW |
---|---|
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" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 // fills in |frame_type|, |frame_producer|, and |stream| if | 41 // fills in |frame_type|, |frame_producer|, and |stream| if |
42 // successful -- otherwise, just returns false. | 42 // successful -- otherwise, just returns false. |
43 bool Dequeue(SpdyFrameType* frame_type, | 43 bool Dequeue(SpdyFrameType* frame_type, |
44 scoped_ptr<SpdyBufferProducer>* frame_producer, | 44 scoped_ptr<SpdyBufferProducer>* frame_producer, |
45 scoped_refptr<SpdyStream>* stream); | 45 scoped_refptr<SpdyStream>* stream); |
46 | 46 |
47 // Removes all pending writes for the given stream, which must be | 47 // Removes all pending writes for the given stream, which must be |
48 // non-NULL. | 48 // non-NULL. |
49 void RemovePendingWritesForStream(const scoped_refptr<SpdyStream>& stream); | 49 void RemovePendingWritesForStream(const scoped_refptr<SpdyStream>& stream); |
50 | 50 |
51 // Removes all pending writes for streams after |last_good_stream_id|. | |
52 void RemovePendingWritesForStreamsAfter(SpdyStreamId last_good_stream_id); | |
akalin
2013/04/18 02:23:11
before i forget, can you also add a unit test for
Ryan Hamilton
2013/04/18 17:18:29
Done.
| |
53 | |
51 // Removes all pending writes. | 54 // Removes all pending writes. |
52 void Clear(); | 55 void Clear(); |
53 | 56 |
54 private: | 57 private: |
55 // A struct holding a frame producer and its associated stream. | 58 // A struct holding a frame producer and its associated stream. |
56 struct PendingWrite { | 59 struct PendingWrite { |
57 SpdyFrameType frame_type; | 60 SpdyFrameType frame_type; |
58 // This has to be a raw pointer since we store this in an STL | 61 // This has to be a raw pointer since we store this in an STL |
59 // container. | 62 // container. |
60 SpdyBufferProducer* frame_producer; | 63 SpdyBufferProducer* frame_producer; |
61 scoped_refptr<SpdyStream> stream; | 64 scoped_refptr<SpdyStream> stream; |
62 | 65 |
63 PendingWrite(); | 66 PendingWrite(); |
64 PendingWrite(SpdyFrameType frame_type, | 67 PendingWrite(SpdyFrameType frame_type, |
65 SpdyBufferProducer* frame_producer, | 68 SpdyBufferProducer* frame_producer, |
66 const scoped_refptr<SpdyStream>& stream); | 69 const scoped_refptr<SpdyStream>& stream); |
67 ~PendingWrite(); | 70 ~PendingWrite(); |
68 }; | 71 }; |
69 | 72 |
70 // The actual write queue, binned by priority. | 73 // The actual write queue, binned by priority. |
71 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; | 74 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; |
72 | 75 |
73 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); | 76 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); |
74 }; | 77 }; |
75 | 78 |
76 } // namespace net | 79 } // namespace net |
77 | 80 |
78 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ | 81 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ |
OLD | NEW |