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 <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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 307 } |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 void ConfigurableConnection::SendChunk() { | 311 void ConfigurableConnection::SendChunk() { |
312 int size = (int)data_.size(); | 312 int size = (int)data_.size(); |
313 const char* chunk_ptr = data_.c_str() + cur_pos_; | 313 const char* chunk_ptr = data_.c_str() + cur_pos_; |
314 int bytes_to_send = std::min(options_.chunk_size_, size - cur_pos_); | 314 int bytes_to_send = std::min(options_.chunk_size_, size - cur_pos_); |
315 | 315 |
316 socket_->Send(chunk_ptr, bytes_to_send); | 316 socket_->Send(chunk_ptr, bytes_to_send); |
317 DLOG(INFO) << "Sent(" << cur_pos_ << "," << bytes_to_send | 317 DVLOG(1) << "Sent(" << cur_pos_ << "," << bytes_to_send << "): " |
318 << "): " << base::StringPiece(chunk_ptr, bytes_to_send); | 318 << base::StringPiece(chunk_ptr, bytes_to_send); |
319 | 319 |
320 cur_pos_ += bytes_to_send; | 320 cur_pos_ += bytes_to_send; |
321 if (cur_pos_ < size) { | 321 if (cur_pos_ < size) { |
322 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(this, | 322 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(this, |
323 &ConfigurableConnection::SendChunk), options_.timeout_); | 323 &ConfigurableConnection::SendChunk), options_.timeout_); |
324 } else { | 324 } else { |
325 socket_ = 0; // close the connection. | 325 socket_ = 0; // close the connection. |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
(...skipping 20 matching lines...) Expand all Loading... |
349 socket_->Send(headers); | 349 socket_->Send(headers); |
350 socket_->Send(content_length_header, true); | 350 socket_->Send(content_length_header, true); |
351 socket_->Send(content); | 351 socket_->Send(content); |
352 socket_ = 0; // close the connection. | 352 socket_ = 0; // close the connection. |
353 return; | 353 return; |
354 } | 354 } |
355 | 355 |
356 if (options_.speed_ == SendOptions::IMMEDIATE_HEADERS_DELAYED_CONTENT) { | 356 if (options_.speed_ == SendOptions::IMMEDIATE_HEADERS_DELAYED_CONTENT) { |
357 socket_->Send(headers); | 357 socket_->Send(headers); |
358 socket_->Send(content_length_header, true); | 358 socket_->Send(content_length_header, true); |
359 DLOG(INFO) << "Headers sent: " << headers << content_length_header; | 359 DVLOG(1) << "Headers sent: " << headers << content_length_header; |
360 data_.append(content); | 360 data_.append(content); |
361 } | 361 } |
362 | 362 |
363 if (options_.speed_ == SendOptions::DELAYED) { | 363 if (options_.speed_ == SendOptions::DELAYED) { |
364 data_ = headers; | 364 data_ = headers; |
365 data_.append(content_length_header); | 365 data_.append(content_length_header); |
366 data_.append("\r\n"); | 366 data_.append("\r\n"); |
367 } | 367 } |
368 | 368 |
369 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 369 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
370 NewRunnableMethod(this, &ConfigurableConnection::SendChunk), | 370 NewRunnableMethod(this, &ConfigurableConnection::SendChunk), |
371 options.timeout_); | 371 options.timeout_); |
372 } | 372 } |
373 | 373 |
374 } // namespace test_server | 374 } // namespace test_server |
OLD | NEW |