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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (result < 0) | 239 if (result < 0) |
240 return result; | 240 return result; |
241 | 241 |
242 next_state_ = STATE_SEND_REQUEST; | 242 next_state_ = STATE_SEND_REQUEST; |
243 return OK; | 243 return OK; |
244 } | 244 } |
245 | 245 |
246 int SpdyNetworkTransaction::DoSendRequest() { | 246 int SpdyNetworkTransaction::DoSendRequest() { |
247 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 247 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
248 CHECK(!stream_.get()); | 248 CHECK(!stream_.get()); |
249 UploadDataStream* upload_data = request_->upload_data ? | 249 UploadDataStream* upload_data = NULL; |
250 new UploadDataStream(request_->upload_data) : NULL; | 250 if (request_->upload_data) { |
| 251 int error_code; |
| 252 upload_data = UploadDataStream::Create(request_->upload_data, &error_code); |
| 253 if (!upload_data) |
| 254 return error_code; |
| 255 } |
251 stream_ = spdy_->GetOrCreateStream(*request_, upload_data, net_log_); | 256 stream_ = spdy_->GetOrCreateStream(*request_, upload_data, net_log_); |
252 // Release the reference to |spdy_| since we don't need it anymore. | 257 // Release the reference to |spdy_| since we don't need it anymore. |
253 spdy_ = NULL; | 258 spdy_ = NULL; |
254 return stream_->SendRequest(upload_data, &response_, &io_callback_); | 259 return stream_->SendRequest(upload_data, &response_, &io_callback_); |
255 } | 260 } |
256 | 261 |
257 int SpdyNetworkTransaction::DoSendRequestComplete(int result) { | 262 int SpdyNetworkTransaction::DoSendRequestComplete(int result) { |
258 if (result < 0) | 263 if (result < 0) |
259 return result; | 264 return result; |
260 | 265 |
(...skipping 22 matching lines...) Expand all Loading... |
283 user_buffer_ = NULL; | 288 user_buffer_ = NULL; |
284 user_buffer_len_ = 0; | 289 user_buffer_len_ = 0; |
285 | 290 |
286 if (result <= 0) | 291 if (result <= 0) |
287 stream_ = NULL; | 292 stream_ = NULL; |
288 | 293 |
289 return result; | 294 return result; |
290 } | 295 } |
291 | 296 |
292 } // namespace net | 297 } // namespace net |
OLD | NEW |