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

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

Issue 2915053003: Remove unused BidirectionalStream::SendData() method and implementations. (Closed)
Patch Set: Cleanup Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bidirectional_stream_quic_impl.h" 5 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 return rv; 161 return rv;
162 162
163 if (stream_->IsDoneReading()) { 163 if (stream_->IsDoneReading()) {
164 // If the write side is closed, OnFinRead() will call 164 // If the write side is closed, OnFinRead() will call
165 // BidirectionalStreamQuicImpl::OnClose(). 165 // BidirectionalStreamQuicImpl::OnClose().
166 stream_->OnFinRead(); 166 stream_->OnFinRead();
167 } 167 }
168 return rv; 168 return rv;
169 } 169 }
170 170
171 void BidirectionalStreamQuicImpl::SendData(const scoped_refptr<IOBuffer>& data,
172 int length,
173 bool end_stream) {
174 ScopedBoolSaver saver(&may_invoke_callbacks_, false);
175 DCHECK(length > 0 || (length == 0 && end_stream));
176 if (!stream_) {
177 LOG(ERROR) << "Trying to send data after stream has been destroyed.";
178 base::ThreadTaskRunnerHandle::Get()->PostTask(
179 FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::NotifyError,
180 weak_factory_.GetWeakPtr(), ERR_UNEXPECTED));
181 return;
182 }
183
184 std::unique_ptr<QuicConnection::ScopedPacketBundler> bundler;
185 if (!has_sent_headers_) {
186 DCHECK(!send_request_headers_automatically_);
187 // Creates a bundler only if there are headers to be sent along with the
188 // single data buffer.
189 bundler =
190 session_->CreatePacketBundler(QuicConnection::SEND_ACK_IF_PENDING);
191 // Sending the request might result in the stream being closed.
192 if (!WriteHeaders())
193 return;
194 }
195
196 QuicStringPiece string_data(data->data(), length);
197 int rv = stream_->WriteStreamData(
198 string_data, end_stream,
199 base::Bind(&BidirectionalStreamQuicImpl::OnSendDataComplete,
200 weak_factory_.GetWeakPtr()));
201 DCHECK(rv == OK || rv == ERR_IO_PENDING);
202 if (rv == OK) {
203 base::ThreadTaskRunnerHandle::Get()->PostTask(
204 FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::OnSendDataComplete,
205 weak_factory_.GetWeakPtr(), OK));
206 }
207 }
208
209 void BidirectionalStreamQuicImpl::SendvData( 171 void BidirectionalStreamQuicImpl::SendvData(
210 const std::vector<scoped_refptr<IOBuffer>>& buffers, 172 const std::vector<scoped_refptr<IOBuffer>>& buffers,
211 const std::vector<int>& lengths, 173 const std::vector<int>& lengths,
212 bool end_stream) { 174 bool end_stream) {
213 ScopedBoolSaver saver(&may_invoke_callbacks_, false); 175 ScopedBoolSaver saver(&may_invoke_callbacks_, false);
214 DCHECK_EQ(buffers.size(), lengths.size()); 176 DCHECK_EQ(buffers.size(), lengths.size());
215 177
216 if (!stream_) { 178 if (!stream_) {
217 LOG(ERROR) << "Trying to send data after stream has been destroyed."; 179 LOG(ERROR) << "Trying to send data after stream has been destroyed.";
218 base::ThreadTaskRunnerHandle::Get()->PostTask( 180 base::ThreadTaskRunnerHandle::Get()->PostTask(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 if (!stream_) 408 if (!stream_)
447 return; 409 return;
448 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 410 closed_stream_received_bytes_ = stream_->stream_bytes_read();
449 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 411 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
450 closed_is_first_stream_ = stream_->IsFirstStream(); 412 closed_is_first_stream_ = stream_->IsFirstStream();
451 stream_->ClearDelegate(); 413 stream_->ClearDelegate();
452 stream_ = nullptr; 414 stream_ = nullptr;
453 } 415 }
454 416
455 } // namespace net 417 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698