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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 int SpdyNetworkTransaction::DoGetStream() { | 247 int SpdyNetworkTransaction::DoGetStream() { |
248 next_state_ = STATE_GET_STREAM_COMPLETE; | 248 next_state_ = STATE_GET_STREAM_COMPLETE; |
249 | 249 |
250 // It is possible that the spdy session was shut down while it was | 250 // It is possible that the spdy session was shut down while it was |
251 // asynchronously waiting to connect. | 251 // asynchronously waiting to connect. |
252 if (spdy_->IsClosed()) | 252 if (spdy_->IsClosed()) |
253 return ERR_CONNECTION_CLOSED; | 253 return ERR_CONNECTION_CLOSED; |
254 | 254 |
255 CHECK(!stream_.get()); | 255 CHECK(!stream_.get()); |
256 | 256 |
257 stream_.reset(new SpdyHttpStream()); | 257 stream_.reset(new SpdyHttpStream(spdy_)); |
258 return stream_->InitializeStream(spdy_, *request_, | 258 return stream_->InitializeStream(request_, net_log_, &io_callback_); |
259 net_log_, &io_callback_); | |
260 } | 259 } |
261 | 260 |
262 int SpdyNetworkTransaction::DoGetStreamComplete(int result) { | 261 int SpdyNetworkTransaction::DoGetStreamComplete(int result) { |
263 if (result < 0) { | 262 if (result < 0) { |
264 return result; | 263 return result; |
265 } | 264 } |
266 | 265 |
267 next_state_ = STATE_SEND_REQUEST; | 266 next_state_ = STATE_SEND_REQUEST; |
268 return OK; | 267 return OK; |
269 } | 268 } |
270 | 269 |
271 int SpdyNetworkTransaction::DoSendRequest() { | 270 int SpdyNetworkTransaction::DoSendRequest() { |
272 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 271 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
273 | 272 |
274 UploadDataStream* upload_data_stream = NULL; | 273 UploadDataStream* upload_data_stream = NULL; |
275 if (request_->upload_data) { | 274 if (request_->upload_data) { |
276 int error_code; | 275 int error_code; |
277 upload_data_stream = UploadDataStream::Create(request_->upload_data, | 276 upload_data_stream = UploadDataStream::Create(request_->upload_data, |
278 &error_code); | 277 &error_code); |
279 if (!upload_data_stream) | 278 if (!upload_data_stream) |
280 return error_code; | 279 return error_code; |
281 } | 280 } |
282 stream_->InitializeRequest(base::Time::Now(), upload_data_stream); | |
283 spdy_ = NULL; | 281 spdy_ = NULL; |
284 | 282 |
285 return stream_->SendRequest(&response_, &io_callback_); | 283 return stream_->SendRequest("", |
| 284 upload_data_stream, |
| 285 &response_, |
| 286 &io_callback_); |
286 } | 287 } |
287 | 288 |
288 int SpdyNetworkTransaction::DoSendRequestComplete(int result) { | 289 int SpdyNetworkTransaction::DoSendRequestComplete(int result) { |
289 if (result < 0) { | 290 if (result < 0) { |
290 stream_.reset(); | 291 stream_.reset(); |
291 return result; | 292 return result; |
292 } | 293 } |
293 | 294 |
294 next_state_ = STATE_READ_HEADERS; | 295 next_state_ = STATE_READ_HEADERS; |
295 return OK; | 296 return OK; |
(...skipping 20 matching lines...) Expand all Loading... |
316 user_buffer_ = NULL; | 317 user_buffer_ = NULL; |
317 user_buffer_len_ = 0; | 318 user_buffer_len_ = 0; |
318 | 319 |
319 if (result <= 0) | 320 if (result <= 0) |
320 stream_.reset(); | 321 stream_.reset(); |
321 | 322 |
322 return result; | 323 return result; |
323 } | 324 } |
324 | 325 |
325 } // namespace net | 326 } // namespace net |
OLD | NEW |