Chromium Code Reviews| 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 && (it->stream->stream_id() > last_good_stream_id || | |
| 101 it->stream->stream_id() == 0)) { | |
|
akalin
2013/04/18 19:58:19
ah, interesting. can you add to the header comment
Ryan Hamilton
2013/04/18 21:33:46
Done.
| |
| 102 delete it->frame_producer; | |
| 103 } else { | |
| 104 *out_it = *it; | |
| 105 ++out_it; | |
| 106 } | |
| 107 } | |
| 108 queue->erase(out_it, queue->end()); | |
| 109 } | |
| 110 } | |
| 111 | |
| 92 void SpdyWriteQueue::Clear() { | 112 void SpdyWriteQueue::Clear() { |
| 93 for (int i = 0; i < NUM_PRIORITIES; ++i) { | 113 for (int i = 0; i < NUM_PRIORITIES; ++i) { |
| 94 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); | 114 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); |
| 95 it != queue_[i].end(); ++it) { | 115 it != queue_[i].end(); ++it) { |
| 96 delete it->frame_producer; | 116 delete it->frame_producer; |
| 97 } | 117 } |
| 98 queue_[i].clear(); | 118 queue_[i].clear(); |
| 99 } | 119 } |
| 100 } | 120 } |
| 101 | 121 |
| 102 } // namespace net | 122 } // namespace net |
| OLD | NEW |