| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // and streams with no stream id. | 57 // and streams with no stream id. |
| 58 void RemovePendingWritesForStreamsAfter(SpdyStreamId last_good_stream_id); | 58 void RemovePendingWritesForStreamsAfter(SpdyStreamId last_good_stream_id); |
| 59 | 59 |
| 60 // Removes all pending writes. | 60 // Removes all pending writes. |
| 61 void Clear(); | 61 void Clear(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 // A struct holding a frame producer and its associated stream. | 64 // A struct holding a frame producer and its associated stream. |
| 65 struct PendingWrite { | 65 struct PendingWrite { |
| 66 SpdyFrameType frame_type; | 66 SpdyFrameType frame_type; |
| 67 // This has to be a raw pointer since we store this in an STL | 67 std::unique_ptr<SpdyBufferProducer> frame_producer; |
| 68 // container. | |
| 69 SpdyBufferProducer* frame_producer; | |
| 70 base::WeakPtr<SpdyStream> stream; | 68 base::WeakPtr<SpdyStream> stream; |
| 71 // Whether |stream| was non-NULL when enqueued. | 69 // Whether |stream| was non-NULL when enqueued. |
| 72 bool has_stream; | 70 bool has_stream; |
| 73 | 71 |
| 74 PendingWrite(); | 72 PendingWrite(); |
| 75 PendingWrite(SpdyFrameType frame_type, | 73 PendingWrite(SpdyFrameType frame_type, |
| 76 SpdyBufferProducer* frame_producer, | 74 std::unique_ptr<SpdyBufferProducer> frame_producer, |
| 77 const base::WeakPtr<SpdyStream>& stream); | 75 const base::WeakPtr<SpdyStream>& stream); |
| 78 PendingWrite(const PendingWrite& other); | |
| 79 ~PendingWrite(); | 76 ~PendingWrite(); |
| 77 PendingWrite(PendingWrite&& other); |
| 78 PendingWrite& operator=(PendingWrite&& other); |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(PendingWrite); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 bool removing_writes_; | 83 bool removing_writes_; |
| 83 | 84 |
| 84 // The actual write queue, binned by priority. | 85 // The actual write queue, binned by priority. |
| 85 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; | 86 std::deque<PendingWrite> queue_[NUM_PRIORITIES]; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); | 88 DISALLOW_COPY_AND_ASSIGN(SpdyWriteQueue); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace net | 91 } // namespace net |
| 91 | 92 |
| 92 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ | 93 #endif // NET_SPDY_SPDY_WRITE_QUEUE_H_ |
| OLD | NEW |