Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1886)

Side by Side Diff: chrome_frame/test/test_server.cc

Issue 8555001: base::Bind: Convert chrome_frame/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win-dies. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/proxy_factory_mock.cc ('k') | chrome_frame/test/url_request_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/logging.h" 10 #include "base/logging.h"
10 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "chrome_frame/test/test_server.h" 15 #include "chrome_frame/test/test_server.h"
15 #include "net/base/winsock_init.h" 16 #include "net/base/winsock_init.h"
16 #include "net/http/http_util.h" 17 #include "net/http/http_util.h"
17 18
18 namespace test_server { 19 namespace test_server {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 int size = (int)data_.size(); 318 int size = (int)data_.size();
318 const char* chunk_ptr = data_.c_str() + cur_pos_; 319 const char* chunk_ptr = data_.c_str() + cur_pos_;
319 int bytes_to_send = std::min(options_.chunk_size_, size - cur_pos_); 320 int bytes_to_send = std::min(options_.chunk_size_, size - cur_pos_);
320 321
321 socket_->Send(chunk_ptr, bytes_to_send); 322 socket_->Send(chunk_ptr, bytes_to_send);
322 DVLOG(1) << "Sent(" << cur_pos_ << "," << bytes_to_send << "): " 323 DVLOG(1) << "Sent(" << cur_pos_ << "," << bytes_to_send << "): "
323 << base::StringPiece(chunk_ptr, bytes_to_send); 324 << base::StringPiece(chunk_ptr, bytes_to_send);
324 325
325 cur_pos_ += bytes_to_send; 326 cur_pos_ += bytes_to_send;
326 if (cur_pos_ < size) { 327 if (cur_pos_ < size) {
327 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(this, 328 MessageLoop::current()->PostDelayedTask(
328 &ConfigurableConnection::SendChunk), options_.timeout_); 329 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this),
330 options_.timeout_);
329 } else { 331 } else {
330 socket_ = 0; // close the connection. 332 socket_ = 0; // close the connection.
331 } 333 }
332 } 334 }
333 335
334 void ConfigurableConnection::Send(const std::string& headers, 336 void ConfigurableConnection::Send(const std::string& headers,
335 const std::string& content) { 337 const std::string& content) {
336 SendOptions options(SendOptions::IMMEDIATE, 0, 0); 338 SendOptions options(SendOptions::IMMEDIATE, 0, 0);
337 SendWithOptions(headers, content, options); 339 SendWithOptions(headers, content, options);
338 } 340 }
(...skipping 25 matching lines...) Expand all
364 DVLOG(1) << "Headers sent: " << headers << content_length_header; 366 DVLOG(1) << "Headers sent: " << headers << content_length_header;
365 data_.append(content); 367 data_.append(content);
366 } 368 }
367 369
368 if (options_.speed_ == SendOptions::DELAYED) { 370 if (options_.speed_ == SendOptions::DELAYED) {
369 data_ = headers; 371 data_ = headers;
370 data_.append(content_length_header); 372 data_.append(content_length_header);
371 data_.append("\r\n"); 373 data_.append("\r\n");
372 } 374 }
373 375
374 MessageLoop::current()->PostDelayedTask(FROM_HERE, 376 MessageLoop::current()->PostDelayedTask(
375 NewRunnableMethod(this, &ConfigurableConnection::SendChunk), 377 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this),
376 options.timeout_); 378 options.timeout_);
377 } 379 }
378 380
379 } // namespace test_server 381 } // namespace test_server
OLDNEW
« no previous file with comments | « chrome_frame/test/proxy_factory_mock.cc ('k') | chrome_frame/test/url_request_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698