Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: net/spdy/spdy_write_queue.cc

Issue 2229393003: net: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_stream_test_util.cc ('k') | net/ssl/channel_id_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 it != queue->end(); ++it) { 110 it != queue->end(); ++it) {
111 if (it->stream.get() == stream.get()) { 111 if (it->stream.get() == stream.get()) {
112 erased_buffer_producers.push_back(it->frame_producer); 112 erased_buffer_producers.push_back(it->frame_producer);
113 } else { 113 } else {
114 *out_it = *it; 114 *out_it = *it;
115 ++out_it; 115 ++out_it;
116 } 116 }
117 } 117 }
118 queue->erase(out_it, queue->end()); 118 queue->erase(out_it, queue->end());
119 removing_writes_ = false; 119 removing_writes_ = false;
120 STLDeleteElements(&erased_buffer_producers); // Invokes callbacks. 120 base::STLDeleteElements(&erased_buffer_producers); // Invokes callbacks.
121 } 121 }
122 122
123 void SpdyWriteQueue::RemovePendingWritesForStreamsAfter( 123 void SpdyWriteQueue::RemovePendingWritesForStreamsAfter(
124 SpdyStreamId last_good_stream_id) { 124 SpdyStreamId last_good_stream_id) {
125 CHECK(!removing_writes_); 125 CHECK(!removing_writes_);
126 removing_writes_ = true; 126 removing_writes_ = true;
127 std::vector<SpdyBufferProducer*> erased_buffer_producers; 127 std::vector<SpdyBufferProducer*> erased_buffer_producers;
128 128
129 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { 129 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) {
130 // Do the actual deletion and removal, preserving FIFO-ness. 130 // Do the actual deletion and removal, preserving FIFO-ness.
131 std::deque<PendingWrite>* queue = &queue_[i]; 131 std::deque<PendingWrite>* queue = &queue_[i];
132 std::deque<PendingWrite>::iterator out_it = queue->begin(); 132 std::deque<PendingWrite>::iterator out_it = queue->begin();
133 for (std::deque<PendingWrite>::const_iterator it = queue->begin(); 133 for (std::deque<PendingWrite>::const_iterator it = queue->begin();
134 it != queue->end(); ++it) { 134 it != queue->end(); ++it) {
135 if (it->stream.get() && (it->stream->stream_id() > last_good_stream_id || 135 if (it->stream.get() && (it->stream->stream_id() > last_good_stream_id ||
136 it->stream->stream_id() == 0)) { 136 it->stream->stream_id() == 0)) {
137 erased_buffer_producers.push_back(it->frame_producer); 137 erased_buffer_producers.push_back(it->frame_producer);
138 } else { 138 } else {
139 *out_it = *it; 139 *out_it = *it;
140 ++out_it; 140 ++out_it;
141 } 141 }
142 } 142 }
143 queue->erase(out_it, queue->end()); 143 queue->erase(out_it, queue->end());
144 } 144 }
145 removing_writes_ = false; 145 removing_writes_ = false;
146 STLDeleteElements(&erased_buffer_producers); // Invokes callbacks. 146 base::STLDeleteElements(&erased_buffer_producers); // Invokes callbacks.
147 } 147 }
148 148
149 void SpdyWriteQueue::Clear() { 149 void SpdyWriteQueue::Clear() {
150 CHECK(!removing_writes_); 150 CHECK(!removing_writes_);
151 removing_writes_ = true; 151 removing_writes_ = true;
152 std::vector<SpdyBufferProducer*> erased_buffer_producers; 152 std::vector<SpdyBufferProducer*> erased_buffer_producers;
153 153
154 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { 154 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) {
155 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); 155 for (std::deque<PendingWrite>::iterator it = queue_[i].begin();
156 it != queue_[i].end(); ++it) { 156 it != queue_[i].end(); ++it) {
157 erased_buffer_producers.push_back(it->frame_producer); 157 erased_buffer_producers.push_back(it->frame_producer);
158 } 158 }
159 queue_[i].clear(); 159 queue_[i].clear();
160 } 160 }
161 removing_writes_ = false; 161 removing_writes_ = false;
162 STLDeleteElements(&erased_buffer_producers); // Invokes callbacks. 162 base::STLDeleteElements(&erased_buffer_producers); // Invokes callbacks.
163 } 163 }
164 164
165 } // namespace net 165 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_test_util.cc ('k') | net/ssl/channel_id_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698