Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <objbase.h> | 6 #include <objbase.h> |
| 7 #include <urlmon.h> | 7 #include <urlmon.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 int bytes_to_send = std::min(options_.chunk_size_, size - cur_pos_); | 331 int bytes_to_send = std::min(options_.chunk_size_, size - cur_pos_); |
| 332 | 332 |
| 333 socket_->Send(chunk_ptr, bytes_to_send); | 333 socket_->Send(chunk_ptr, bytes_to_send); |
| 334 VLOG(1) << "Sent(" << cur_pos_ << "," << bytes_to_send << "): " | 334 VLOG(1) << "Sent(" << cur_pos_ << "," << bytes_to_send << "): " |
| 335 << base::StringPiece(chunk_ptr, bytes_to_send); | 335 << base::StringPiece(chunk_ptr, bytes_to_send); |
| 336 | 336 |
| 337 cur_pos_ += bytes_to_send; | 337 cur_pos_ += bytes_to_send; |
| 338 if (cur_pos_ < size) { | 338 if (cur_pos_ < size) { |
| 339 MessageLoop::current()->PostDelayedTask( | 339 MessageLoop::current()->PostDelayedTask( |
| 340 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), | 340 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), |
| 341 options_.timeout_); | 341 base::TimeDelta::FromMilliseconds(options_.timeout_)); |
|
ananta
2012/04/13 17:50:21
Please check here whether the timeout is specified
| |
| 342 } else { | 342 } else { |
| 343 socket_ = 0; // close the connection. | 343 socket_ = 0; // close the connection. |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 | 346 |
| 347 void ConfigurableConnection::Close() { | 347 void ConfigurableConnection::Close() { |
| 348 socket_ = NULL; | 348 socket_ = NULL; |
| 349 } | 349 } |
| 350 | 350 |
| 351 void ConfigurableConnection::Send(const std::string& headers, | 351 void ConfigurableConnection::Send(const std::string& headers, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 } | 387 } |
| 388 | 388 |
| 389 if (options_.speed_ == SendOptions::DELAYED) { | 389 if (options_.speed_ == SendOptions::DELAYED) { |
| 390 data_ = headers; | 390 data_ = headers; |
| 391 data_.append(content_length_header); | 391 data_.append(content_length_header); |
| 392 data_.append("\r\n"); | 392 data_.append("\r\n"); |
| 393 } | 393 } |
| 394 | 394 |
| 395 MessageLoop::current()->PostDelayedTask( | 395 MessageLoop::current()->PostDelayedTask( |
| 396 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), | 396 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), |
| 397 options.timeout_); | 397 base::TimeDelta::FromMilliseconds(options.timeout_)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace test_server | 400 } // namespace test_server |
| OLD | NEW |