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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 void SpdyWriteQueue::Clear() { | 92 void SpdyWriteQueue::Clear() { |
| 93 for (int i = 0; i < NUM_PRIORITIES; ++i) { | 93 for (int i = 0; i < NUM_PRIORITIES; ++i) { |
| 94 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); | 94 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); |
| 95 it != queue_[i].end(); ++it) { | 95 it != queue_[i].end(); ++it) { |
| 96 delete it->frame_producer; | 96 delete it->frame_producer; |
| 97 } | 97 } |
| 98 queue_[i].clear(); | 98 queue_[i].clear(); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 void SpdyWriteQueue::ClearAfter(SpdyStreamId last_good_stream_id) { | |
| 103 for (int i = 0; i < NUM_PRIORITIES; ++i) { | |
| 104 std::deque<PendingWrite>::iterator it = queue_[i].begin(); | |
| 105 while (it != queue_[i].end()) { | |
| 106 if (it->stream->stream_id() > last_good_stream_id) { | |
| 107 delete it->frame_producer; | |
| 108 it = queue_[i].erase(it); | |
|
akalin
2013/04/17 21:14:20
unfortunately, deque::erase is O(n). Can you do so
Ryan Hamilton
2013/04/18 00:30:40
Done.
| |
| 109 } else { | |
| 110 ++it; | |
| 111 } | |
| 112 } | |
| 113 } | |
| 114 } | |
| 115 | |
| 102 } // namespace net | 116 } // namespace net |
| OLD | NEW |