| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_network_transaction.h" | 5 #include "net/spdy/spdy_network_transaction.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 250 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| 251 CHECK(!stream_.get()); | 251 CHECK(!stream_.get()); |
| 252 UploadDataStream* upload_data = NULL; | 252 UploadDataStream* upload_data = NULL; |
| 253 if (request_->upload_data) { | 253 if (request_->upload_data) { |
| 254 int error_code; | 254 int error_code; |
| 255 upload_data = UploadDataStream::Create(request_->upload_data, &error_code); | 255 upload_data = UploadDataStream::Create(request_->upload_data, &error_code); |
| 256 if (!upload_data) | 256 if (!upload_data) |
| 257 return error_code; | 257 return error_code; |
| 258 } | 258 } |
| 259 scoped_refptr<SpdyStream> spdy_stream; | 259 scoped_refptr<SpdyStream> spdy_stream; |
| 260 if (request_->method == "GET") | 260 if (request_->method == "GET") { |
| 261 spdy_stream = spdy_->GetPushStream(request_->url, net_log_); | 261 int error = spdy_->GetPushStream(request_->url, &spdy_stream, net_log_); |
| 262 if (error != OK) |
| 263 return error; |
| 264 } |
| 262 if (spdy_stream.get()) { | 265 if (spdy_stream.get()) { |
| 263 DCHECK(spdy_stream->pushed()); | 266 DCHECK(spdy_stream->pushed()); |
| 264 CHECK(spdy_stream->GetDelegate() == NULL); | 267 CHECK(spdy_stream->GetDelegate() == NULL); |
| 265 stream_.reset(new SpdyHttpStream(spdy_stream)); | 268 stream_.reset(new SpdyHttpStream(spdy_stream)); |
| 266 stream_->InitializeRequest(*request_, base::Time::Now(), NULL); | 269 stream_->InitializeRequest(*request_, base::Time::Now(), NULL); |
| 267 // "vary" field? | 270 // "vary" field? |
| 268 } else { | 271 } else { |
| 269 spdy_stream = spdy_->CreateStream(request_->url, | 272 int error = spdy_->CreateStream(request_->url, |
| 270 request_->priority, | 273 request_->priority, |
| 271 net_log_); | 274 &spdy_stream, |
| 275 net_log_); |
| 276 if (error != OK) |
| 277 return error; |
| 272 DCHECK(!spdy_stream->pushed()); | 278 DCHECK(!spdy_stream->pushed()); |
| 273 CHECK(spdy_stream->GetDelegate() == NULL); | 279 CHECK(spdy_stream->GetDelegate() == NULL); |
| 274 stream_.reset(new SpdyHttpStream(spdy_stream)); | 280 stream_.reset(new SpdyHttpStream(spdy_stream)); |
| 275 stream_->InitializeRequest(*request_, base::Time::Now(), upload_data); | 281 stream_->InitializeRequest(*request_, base::Time::Now(), upload_data); |
| 276 } | 282 } |
| 277 spdy_ = NULL; | 283 spdy_ = NULL; |
| 278 return stream_->SendRequest(&response_, &io_callback_); | 284 return stream_->SendRequest(&response_, &io_callback_); |
| 279 } | 285 } |
| 280 | 286 |
| 281 int SpdyNetworkTransaction::DoSendRequestComplete(int result) { | 287 int SpdyNetworkTransaction::DoSendRequestComplete(int result) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 309 user_buffer_ = NULL; | 315 user_buffer_ = NULL; |
| 310 user_buffer_len_ = 0; | 316 user_buffer_len_ = 0; |
| 311 | 317 |
| 312 if (result <= 0) | 318 if (result <= 0) |
| 313 stream_.reset(); | 319 stream_.reset(); |
| 314 | 320 |
| 315 return result; | 321 return result; |
| 316 } | 322 } |
| 317 | 323 |
| 318 } // namespace net | 324 } // namespace net |
| OLD | NEW |