| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
| 14 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 15 #include "net/http/http_request_headers.h" | 15 #include "net/http/http_request_headers.h" |
| 16 #include "net/http/http_request_info.h" | 16 #include "net/http/http_request_info.h" |
| 17 #include "net/http/http_response_info.h" | 17 #include "net/http/http_response_info.h" |
| 18 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 19 #include "net/spdy/spdy_http_utils.h" | 19 #include "net/spdy/spdy_http_utils.h" |
| 20 #include "net/spdy/spdy_session.h" | 20 #include "net/spdy/spdy_session.h" |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session, bool direct) | 24 SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session, |
| 25 bool direct) |
| 25 : ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_factory_(this)), | 26 : ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_factory_(this)), |
| 26 stream_(NULL), | 27 stream_(NULL), |
| 27 spdy_session_(spdy_session), | 28 spdy_session_(spdy_session), |
| 28 response_info_(NULL), | 29 response_info_(NULL), |
| 29 download_finished_(false), | 30 download_finished_(false), |
| 30 response_headers_received_(false), | 31 response_headers_received_(false), |
| 31 user_callback_(NULL), | 32 user_callback_(NULL), |
| 32 user_buffer_len_(0), | 33 user_buffer_len_(0), |
| 33 buffered_read_callback_pending_(false), | 34 buffered_read_callback_pending_(false), |
| 34 more_read_data_pending_(false), | 35 more_read_data_pending_(false), |
| 35 direct_(direct) { } | 36 direct_(direct) { } |
| 36 | 37 |
| 38 void SpdyHttpStream::InitializeWithExistingStream(SpdyStream* spdy_stream) { |
| 39 stream_ = spdy_stream; |
| 40 stream_->SetDelegate(this); |
| 41 response_headers_received_ = true; |
| 42 } |
| 43 |
| 37 SpdyHttpStream::~SpdyHttpStream() { | 44 SpdyHttpStream::~SpdyHttpStream() { |
| 38 if (stream_) | 45 if (stream_) |
| 39 stream_->DetachDelegate(); | 46 stream_->DetachDelegate(); |
| 40 } | 47 } |
| 41 | 48 |
| 42 int SpdyHttpStream::InitializeStream(const HttpRequestInfo* request_info, | 49 int SpdyHttpStream::InitializeStream(const HttpRequestInfo* request_info, |
| 43 const BoundNetLog& stream_net_log, | 50 const BoundNetLog& stream_net_log, |
| 44 CompletionCallback* callback) { | 51 CompletionCallback* callback) { |
| 52 DCHECK(!stream_.get()); |
| 45 if (spdy_session_->IsClosed()) | 53 if (spdy_session_->IsClosed()) |
| 46 return ERR_CONNECTION_CLOSED; | 54 return ERR_CONNECTION_CLOSED; |
| 47 | 55 |
| 48 request_info_ = request_info; | 56 request_info_ = request_info; |
| 49 if (request_info_->method == "GET") { | 57 if (request_info_->method == "GET") { |
| 50 int error = spdy_session_->GetPushStream(request_info_->url, &stream_, | 58 int error = spdy_session_->GetPushStream(request_info_->url, &stream_, |
| 51 stream_net_log); | 59 stream_net_log); |
| 52 if (error != OK) | 60 if (error != OK) |
| 53 return error; | 61 return error; |
| 54 } | 62 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 stream_->GetSSLInfo(ssl_info, &using_npn); | 427 stream_->GetSSLInfo(ssl_info, &using_npn); |
| 420 } | 428 } |
| 421 | 429 |
| 422 void SpdyHttpStream::GetSSLCertRequestInfo( | 430 void SpdyHttpStream::GetSSLCertRequestInfo( |
| 423 SSLCertRequestInfo* cert_request_info) { | 431 SSLCertRequestInfo* cert_request_info) { |
| 424 DCHECK(stream_); | 432 DCHECK(stream_); |
| 425 stream_->GetSSLCertRequestInfo(cert_request_info); | 433 stream_->GetSSLCertRequestInfo(cert_request_info); |
| 426 } | 434 } |
| 427 | 435 |
| 428 } // namespace net | 436 } // namespace net |
| OLD | NEW |