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

Side by Side Diff: net/quic/chromium/quic_chromium_client_stream.cc

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/quic/chromium/quic_chromium_client_stream.h" 5 #include "net/quic/chromium/quic_chromium_client_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 SpdyPriority QuicChromiumClientStream::priority() const { 140 SpdyPriority QuicChromiumClientStream::priority() const {
141 if (delegate_ && delegate_->HasSendHeadersComplete()) { 141 if (delegate_ && delegate_->HasSendHeadersComplete()) {
142 return QuicSpdyStream::priority(); 142 return QuicSpdyStream::priority();
143 } 143 }
144 return net::kV3HighestPriority; 144 return net::kV3HighestPriority;
145 } 145 }
146 146
147 int QuicChromiumClientStream::WriteStreamData( 147 int QuicChromiumClientStream::WriteStreamData(
148 base::StringPiece data, 148 QuicStringPiece data,
149 bool fin, 149 bool fin,
150 const CompletionCallback& callback) { 150 const CompletionCallback& callback) {
151 // We should not have data buffered. 151 // We should not have data buffered.
152 DCHECK(!HasBufferedData()); 152 DCHECK(!HasBufferedData());
153 // Writes the data, or buffers it. 153 // Writes the data, or buffers it.
154 WriteOrBufferData(data, fin, nullptr); 154 WriteOrBufferData(data, fin, nullptr);
155 if (!HasBufferedData()) { 155 if (!HasBufferedData()) {
156 return OK; 156 return OK;
157 } 157 }
158 158
159 callback_ = callback; 159 callback_ = callback;
160 return ERR_IO_PENDING; 160 return ERR_IO_PENDING;
161 } 161 }
162 162
163 int QuicChromiumClientStream::WritevStreamData( 163 int QuicChromiumClientStream::WritevStreamData(
164 const std::vector<scoped_refptr<IOBuffer>>& buffers, 164 const std::vector<scoped_refptr<IOBuffer>>& buffers,
165 const std::vector<int>& lengths, 165 const std::vector<int>& lengths,
166 bool fin, 166 bool fin,
167 const CompletionCallback& callback) { 167 const CompletionCallback& callback) {
168 // Must not be called when data is buffered. 168 // Must not be called when data is buffered.
169 DCHECK(!HasBufferedData()); 169 DCHECK(!HasBufferedData());
170 // Writes the data, or buffers it. 170 // Writes the data, or buffers it.
171 for (size_t i = 0; i < buffers.size(); ++i) { 171 for (size_t i = 0; i < buffers.size(); ++i) {
172 bool is_fin = fin && (i == buffers.size() - 1); 172 bool is_fin = fin && (i == buffers.size() - 1);
173 base::StringPiece string_data(buffers[i]->data(), lengths[i]); 173 QuicStringPiece string_data(buffers[i]->data(), lengths[i]);
174 WriteOrBufferData(string_data, is_fin, nullptr); 174 WriteOrBufferData(string_data, is_fin, nullptr);
175 } 175 }
176 if (!HasBufferedData()) { 176 if (!HasBufferedData()) {
177 return OK; 177 return OK;
178 } 178 }
179 179
180 callback_ = callback; 180 callback_ = callback;
181 return ERR_IO_PENDING; 181 return ERR_IO_PENDING;
182 } 182 }
183 183
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 void QuicChromiumClientStream::DisableConnectionMigration() { 286 void QuicChromiumClientStream::DisableConnectionMigration() {
287 can_migrate_ = false; 287 can_migrate_ = false;
288 } 288 }
289 289
290 bool QuicChromiumClientStream::IsFirstStream() { 290 bool QuicChromiumClientStream::IsFirstStream() {
291 return id() == kHeadersStreamId + 2; 291 return id() == kHeadersStreamId + 2;
292 } 292 }
293 293
294 } // namespace net 294 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream.h ('k') | net/quic/chromium/quic_chromium_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698