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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return false; | 70 return false; |
71 } | 71 } |
72 | 72 |
73 void SpdyWriteQueue::RemovePendingWritesForStream( | 73 void SpdyWriteQueue::RemovePendingWritesForStream( |
74 const base::WeakPtr<SpdyStream>& stream) { | 74 const base::WeakPtr<SpdyStream>& stream) { |
75 RequestPriority priority = stream->priority(); | 75 RequestPriority priority = stream->priority(); |
76 CHECK_GE(priority, MINIMUM_PRIORITY); | 76 CHECK_GE(priority, MINIMUM_PRIORITY); |
77 CHECK_LE(priority, MAXIMUM_PRIORITY); | 77 CHECK_LE(priority, MAXIMUM_PRIORITY); |
78 | 78 |
79 DCHECK(stream.get()); | 79 DCHECK(stream.get()); |
80 if (DCHECK_IS_ON()) { | 80 #if DCHECK_IS_ON |
81 // |stream| should not have pending writes in a queue not matching | 81 // |stream| should not have pending writes in a queue not matching |
82 // its priority. | 82 // its priority. |
83 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { | 83 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { |
84 if (priority == i) | 84 if (priority == i) |
85 continue; | 85 continue; |
86 for (std::deque<PendingWrite>::const_iterator it = queue_[i].begin(); | 86 for (std::deque<PendingWrite>::const_iterator it = queue_[i].begin(); |
87 it != queue_[i].end(); ++it) { | 87 it != queue_[i].end(); ++it) { |
88 DCHECK_NE(it->stream.get(), stream.get()); | 88 DCHECK_NE(it->stream.get(), stream.get()); |
89 } | |
90 } | 89 } |
91 } | 90 } |
| 91 #endif |
92 | 92 |
93 // Do the actual deletion and removal, preserving FIFO-ness. | 93 // Do the actual deletion and removal, preserving FIFO-ness. |
94 std::deque<PendingWrite>* queue = &queue_[priority]; | 94 std::deque<PendingWrite>* queue = &queue_[priority]; |
95 std::deque<PendingWrite>::iterator out_it = queue->begin(); | 95 std::deque<PendingWrite>::iterator out_it = queue->begin(); |
96 for (std::deque<PendingWrite>::const_iterator it = queue->begin(); | 96 for (std::deque<PendingWrite>::const_iterator it = queue->begin(); |
97 it != queue->end(); ++it) { | 97 it != queue->end(); ++it) { |
98 if (it->stream.get() == stream.get()) { | 98 if (it->stream.get() == stream.get()) { |
99 delete it->frame_producer; | 99 delete it->frame_producer; |
100 } else { | 100 } else { |
101 *out_it = *it; | 101 *out_it = *it; |
(...skipping 27 matching lines...) Expand all Loading... |
129 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { | 129 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { |
130 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); | 130 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); |
131 it != queue_[i].end(); ++it) { | 131 it != queue_[i].end(); ++it) { |
132 delete it->frame_producer; | 132 delete it->frame_producer; |
133 } | 133 } |
134 queue_[i].clear(); | 134 queue_[i].clear(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 } // namespace net | 138 } // namespace net |
OLD | NEW |