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

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

Issue 2064593002: Change SPDY to call request_callback after data is sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « no previous file | net/spdy/spdy_http_stream_unittest.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/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void SpdyHttpStream::Cancel() { 295 void SpdyHttpStream::Cancel() {
296 request_callback_.Reset(); 296 request_callback_.Reset();
297 response_callback_.Reset(); 297 response_callback_.Reset();
298 if (stream_.get()) { 298 if (stream_.get()) {
299 stream_->Cancel(); 299 stream_->Cancel();
300 DCHECK(!stream_.get()); 300 DCHECK(!stream_.get());
301 } 301 }
302 } 302 }
303 303
304 void SpdyHttpStream::OnRequestHeadersSent() { 304 void SpdyHttpStream::OnRequestHeadersSent() {
305 if (!request_callback_.is_null())
306 DoRequestCallback(OK);
307
308 // TODO(akalin): Do this immediately after sending the request 305 // TODO(akalin): Do this immediately after sending the request
Bence 2016/06/13 13:53:36 I do not exactly understand this TODO, but my impr
maksims (do not use this acc) 2016/06/15 07:51:45 Done.
309 // headers. 306 // headers.
310 if (HasUploadData()) 307 if (HasUploadData()) {
311 ReadAndSendRequestBodyData(); 308 ReadAndSendRequestBodyData();
309 } else {
310 if (!request_callback_.is_null())
311 DoRequestCallback(OK);
312 }
312 } 313 }
313 314
314 SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated( 315 SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated(
315 const SpdyHeaderBlock& response_headers) { 316 const SpdyHeaderBlock& response_headers) {
316 CHECK_EQ(response_headers_status_, RESPONSE_HEADERS_ARE_INCOMPLETE); 317 CHECK_EQ(response_headers_status_, RESPONSE_HEADERS_ARE_INCOMPLETE);
317 318
318 if (!response_info_) { 319 if (!response_info_) {
319 DCHECK_EQ(stream_->type(), SPDY_PUSH_STREAM); 320 DCHECK_EQ(stream_->type(), SPDY_PUSH_STREAM);
320 push_response_info_.reset(new HttpResponseInfo); 321 push_response_info_.reset(new HttpResponseInfo);
321 response_info_ = push_response_info_.get(); 322 response_info_ = push_response_info_.get();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 const bool eof = request_info_->upload_data_stream->IsEOF(); 461 const bool eof = request_info_->upload_data_stream->IsEOF();
461 // Only the final fame may have a length of 0. 462 // Only the final fame may have a length of 0.
462 if (eof) { 463 if (eof) {
463 CHECK_GE(request_body_buf_size_, 0); 464 CHECK_GE(request_body_buf_size_, 0);
464 } else { 465 } else {
465 CHECK_GT(request_body_buf_size_, 0); 466 CHECK_GT(request_body_buf_size_, 0);
466 } 467 }
467 stream_->SendData(request_body_buf_.get(), 468 stream_->SendData(request_body_buf_.get(),
468 request_body_buf_size_, 469 request_body_buf_size_,
469 eof ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND); 470 eof ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND);
471
472 if (!request_callback_.is_null())
473 DoRequestCallback(OK);
mmenke 2016/06/13 14:31:06 BUG: Shouldn't we only do this if eof is true?
mmenke 2016/06/13 14:48:27 Actually, that's not enough. ReadAndSendRequestBo
maksims (do not use this acc) 2016/06/14 08:35:03 Oh,oh, my mistake. I haven't noticed that. I check
mmenke 2016/06/14 15:25:44 This one.... If request_info_->upload_data_stream
maksims (do not use this acc) 2016/06/15 07:51:45 As I said if I call OnRequestBodyReadCompleted fro
470 } 474 }
471 475
472 void SpdyHttpStream::ScheduleBufferedReadCallback() { 476 void SpdyHttpStream::ScheduleBufferedReadCallback() {
473 // If there is already a scheduled DoBufferedReadCallback, don't issue 477 // If there is already a scheduled DoBufferedReadCallback, don't issue
474 // another one. Mark that we have received more data and return. 478 // another one. Mark that we have received more data and return.
475 if (buffered_read_callback_pending_) { 479 if (buffered_read_callback_pending_) {
476 more_read_data_pending_ = true; 480 more_read_data_pending_ = true;
477 return; 481 return;
478 } 482 }
479 483
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; 588 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2;
585 return; 589 return;
586 } 590 }
587 591
588 void SpdyHttpStream::SetPriority(RequestPriority priority) { 592 void SpdyHttpStream::SetPriority(RequestPriority priority) {
589 // TODO(akalin): Plumb this through to |stream_request_| and 593 // TODO(akalin): Plumb this through to |stream_request_| and
590 // |stream_|. 594 // |stream_|.
591 } 595 }
592 596
593 } // namespace net 597 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698