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 #include "net/spdy/spdy_write_queue.h" | 5 #include "net/spdy/spdy_write_queue.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/spdy/spdy_buffer.h" | 10 #include "net/spdy/spdy_buffer.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (it->stream == stream) { | 82 if (it->stream == stream) { |
83 delete it->frame_producer; | 83 delete it->frame_producer; |
84 } else { | 84 } else { |
85 *out_it = *it; | 85 *out_it = *it; |
86 ++out_it; | 86 ++out_it; |
87 } | 87 } |
88 } | 88 } |
89 queue->erase(out_it, queue->end()); | 89 queue->erase(out_it, queue->end()); |
90 } | 90 } |
91 | 91 |
| 92 void SpdyWriteQueue::RemovePendingWritesForStreamsAfter( |
| 93 SpdyStreamId last_good_stream_id) { |
| 94 for (int i = 0; i < NUM_PRIORITIES; ++i) { |
| 95 // Do the actual deletion and removal, preserving FIFO-ness. |
| 96 std::deque<PendingWrite>* queue = &queue_[i]; |
| 97 std::deque<PendingWrite>::iterator out_it = queue->begin(); |
| 98 for (std::deque<PendingWrite>::const_iterator it = queue->begin(); |
| 99 it != queue->end(); ++it) { |
| 100 if (it->stream->stream_id() > last_good_stream_id) { |
| 101 delete it->frame_producer; |
| 102 } else { |
| 103 *out_it = *it; |
| 104 ++out_it; |
| 105 } |
| 106 } |
| 107 queue->erase(out_it, queue->end()); |
| 108 } |
| 109 } |
| 110 |
92 void SpdyWriteQueue::Clear() { | 111 void SpdyWriteQueue::Clear() { |
93 for (int i = 0; i < NUM_PRIORITIES; ++i) { | 112 for (int i = 0; i < NUM_PRIORITIES; ++i) { |
94 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); | 113 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); |
95 it != queue_[i].end(); ++it) { | 114 it != queue_[i].end(); ++it) { |
96 delete it->frame_producer; | 115 delete it->frame_producer; |
97 } | 116 } |
98 queue_[i].clear(); | 117 queue_[i].clear(); |
99 } | 118 } |
100 } | 119 } |
101 | 120 |
102 } // namespace net | 121 } // namespace net |
OLD | NEW |