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 // and streams with no stream id. |
| 53 void RemovePendingWritesForStreamsAfter(SpdyStreamId last_good_stream_id); |
| 54 |
51 // Removes all pending writes. | 55 // Removes all pending writes. |
52 void Clear(); | 56 void Clear(); |
53 | 57 |
54 private: | 58 private: |
55 // A struct holding a frame producer and its associated stream. | 59 // A struct holding a frame producer and its associated stream. |
56 struct PendingWrite { | 60 struct PendingWrite { |
57 SpdyFrameType frame_type; | 61 SpdyFrameType frame_type; |
58 // This has to be a raw pointer since we store this in an STL | 62 // This has to be a raw pointer since we store this in an STL |
59 // container. | 63 // container. |
60 SpdyBufferProducer* frame_producer; | 64 SpdyBufferProducer* frame_producer; |
61 scoped_refptr<SpdyStream> stream; | 65 scoped_refptr<SpdyStream> stream; |
62 | 66 |
63 PendingWrite(); | 67 PendingWrite(); |
64 PendingWrite(SpdyFrameType frame_type, | 68 PendingWrite(SpdyFrameType frame_type, |
65 SpdyBufferProducer* frame_producer, | 69 SpdyBufferProducer* frame_producer, |
66 const scoped_refptr<SpdyStream>& stream); | 70 const scoped_refptr<SpdyStream>& stream); |
67 ~PendingWrite(); | 71 ~PendingWrite(); |
68 }; | 72 }; |
69 | 73 |
70 // The actual write queue, binned by priority. | 74 // The actual write queue, binned by priority. |
71 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; | 75 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; |
72 | 76 |
73 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); | 77 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); |
74 }; | 78 }; |
75 | 79 |
76 } // namespace net | 80 } // namespace net |
77 | 81 |
78 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ | 82 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ |
OLD | NEW |