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

Unified Diff: net/spdy/bidirectional_stream_spdy_impl.cc

Issue 1992953004: [Cronet] Make delaying sending request headers explicit in bidirectional stream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: correct a typo 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/bidirectional_stream_spdy_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/bidirectional_stream_spdy_impl.cc
diff --git a/net/spdy/bidirectional_stream_spdy_impl.cc b/net/spdy/bidirectional_stream_spdy_impl.cc
index 42341ee5411e371f1391d9c55762dd99db03c0f7..a8531d961a5f1ebeb116d2e6554c3de3c435191b 100644
--- a/net/spdy/bidirectional_stream_spdy_impl.cc
+++ b/net/spdy/bidirectional_stream_spdy_impl.cc
@@ -38,7 +38,6 @@ BidirectionalStreamSpdyImpl::BidirectionalStreamSpdyImpl(
closed_stream_status_(ERR_FAILED),
closed_stream_received_bytes_(0),
closed_stream_sent_bytes_(0),
- disable_auto_flush_(false),
weak_factory_(this) {}
BidirectionalStreamSpdyImpl::~BidirectionalStreamSpdyImpl() {
@@ -51,13 +50,12 @@ BidirectionalStreamSpdyImpl::~BidirectionalStreamSpdyImpl() {
void BidirectionalStreamSpdyImpl::Start(
const BidirectionalStreamRequestInfo* request_info,
const BoundNetLog& net_log,
- bool disable_auto_flush,
+ bool /*send_request_headers_automatically*/,
BidirectionalStreamImpl::Delegate* delegate,
std::unique_ptr<base::Timer> timer) {
DCHECK(!stream_);
DCHECK(timer);
- disable_auto_flush_ = disable_auto_flush;
delegate_ = delegate;
timer_ = std::move(timer);
@@ -77,6 +75,11 @@ void BidirectionalStreamSpdyImpl::Start(
OnStreamInitialized(rv);
}
+void BidirectionalStreamSpdyImpl::SendRequestHeaders() {
+ // Request headers will be sent automatically.
+ NOTREACHED();
+}
+
int BidirectionalStreamSpdyImpl::ReadData(IOBuffer* buf, int buf_len) {
if (stream_)
DCHECK(!stream_->IsIdle());
@@ -103,7 +106,6 @@ void BidirectionalStreamSpdyImpl::SendData(const scoped_refptr<IOBuffer>& data,
bool end_stream) {
DCHECK(!stream_closed_);
DCHECK(stream_);
- DCHECK(!disable_auto_flush_);
stream_->SendData(data.get(), length,
end_stream ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND);
@@ -115,7 +117,6 @@ void BidirectionalStreamSpdyImpl::SendvData(
bool end_stream) {
DCHECK(!stream_closed_);
DCHECK(stream_);
- DCHECK(disable_auto_flush_);
DCHECK_EQ(buffers.size(), lengths.size());
int total_len = 0;
@@ -171,6 +172,7 @@ void BidirectionalStreamSpdyImpl::OnRequestHeadersSent() {
DCHECK(stream_);
negotiated_protocol_ = stream_->GetProtocol();
+ delegate_->OnStreamReady(/*request_headers_sent=*/true);
}
SpdyResponseHeadersStatus BidirectionalStreamSpdyImpl::OnResponseHeadersUpdated(
@@ -205,10 +207,7 @@ void BidirectionalStreamSpdyImpl::OnDataSent() {
DCHECK(stream_);
DCHECK(!stream_closed_);
- if (disable_auto_flush_) {
- DCHECK(pending_combined_buffer_);
- pending_combined_buffer_ = nullptr;
- }
+ pending_combined_buffer_ = nullptr;
delegate_->OnDataSent();
}
@@ -239,7 +238,7 @@ void BidirectionalStreamSpdyImpl::OnClose(int status) {
DoBufferedRead();
}
-void BidirectionalStreamSpdyImpl::SendRequestHeaders() {
+int BidirectionalStreamSpdyImpl::SendRequestHeadersHelper() {
std::unique_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock);
HttpRequestInfo http_request_info;
http_request_info.url = request_info_->url;
@@ -249,10 +248,10 @@ void BidirectionalStreamSpdyImpl::SendRequestHeaders() {
CreateSpdyHeadersFromHttpRequest(
http_request_info, http_request_info.extra_headers,
stream_->GetProtocolVersion(), true, headers.get());
- stream_->SendRequestHeaders(std::move(headers),
- request_info_->end_stream_on_headers
- ? NO_MORE_DATA_TO_SEND
- : MORE_DATA_TO_SEND);
+ return stream_->SendRequestHeaders(std::move(headers),
+ request_info_->end_stream_on_headers
+ ? NO_MORE_DATA_TO_SEND
+ : MORE_DATA_TO_SEND);
}
void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) {
@@ -260,9 +259,13 @@ void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) {
if (rv == OK) {
stream_ = stream_request_.ReleaseStream();
stream_->SetDelegate(this);
- SendRequestHeaders();
- delegate_->OnStreamReady();
- return;
+ rv = SendRequestHeadersHelper();
+ if (rv == OK) {
+ OnRequestHeadersSent();
+ return;
+ } else if (rv == ERR_IO_PENDING) {
+ return;
+ }
}
delegate_->OnFailed(rv);
}
« no previous file with comments | « net/spdy/bidirectional_stream_spdy_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698