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

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

Issue 1969893002: Remove unnecessary array allocation in cronet_bidirectional_stream_adapter.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add include vector Created 4 years, 7 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/quic/quic_chromium_client_stream.h ('k') | net/quic/quic_chromium_client_stream_test.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) 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/quic_chromium_client_stream.h" 5 #include "net/quic/quic_chromium_client_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 WriteOrBufferData(data, fin, nullptr); 133 WriteOrBufferData(data, fin, nullptr);
134 if (!HasBufferedData()) { 134 if (!HasBufferedData()) {
135 return OK; 135 return OK;
136 } 136 }
137 137
138 callback_ = callback; 138 callback_ = callback;
139 return ERR_IO_PENDING; 139 return ERR_IO_PENDING;
140 } 140 }
141 141
142 int QuicChromiumClientStream::WritevStreamData( 142 int QuicChromiumClientStream::WritevStreamData(
143 const std::vector<IOBuffer*>& buffers, 143 const std::vector<scoped_refptr<IOBuffer>>& buffers,
144 const std::vector<int>& lengths, 144 const std::vector<int>& lengths,
145 bool fin, 145 bool fin,
146 const CompletionCallback& callback) { 146 const CompletionCallback& callback) {
147 // Must not be called when data is buffered. 147 // Must not be called when data is buffered.
148 DCHECK(!HasBufferedData()); 148 DCHECK(!HasBufferedData());
149 // Writes the data, or buffers it. 149 // Writes the data, or buffers it.
150 for (size_t i = 0; i < buffers.size(); ++i) { 150 for (size_t i = 0; i < buffers.size(); ++i) {
151 bool is_fin = fin && (i == buffers.size() - 1); 151 bool is_fin = fin && (i == buffers.size() - 1);
152 base::StringPiece string_data(buffers[i]->data(), lengths[i]); 152 base::StringPiece string_data(buffers[i]->data(), lengths[i]);
153 WriteOrBufferData(string_data, is_fin, nullptr); 153 WriteOrBufferData(string_data, is_fin, nullptr);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } else { 252 } else {
253 delegate_tasks_.push_back(closure); 253 delegate_tasks_.push_back(closure);
254 } 254 }
255 } 255 }
256 256
257 void QuicChromiumClientStream::DisableConnectionMigration() { 257 void QuicChromiumClientStream::DisableConnectionMigration() {
258 can_migrate_ = false; 258 can_migrate_ = false;
259 } 259 }
260 260
261 } // namespace net 261 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_stream.h ('k') | net/quic/quic_chromium_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698