| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 int clients_; | 45 int clients_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // A network client | 48 // A network client |
| 49 class Client { | 49 class Client { |
| 50 public: | 50 public: |
| 51 Client(net::HttpTransactionFactory* factory, const std::string& url) : | 51 Client(net::HttpTransactionFactory* factory, const std::string& url) : |
| 52 url_(url), | 52 url_(url), |
| 53 transaction_(factory->CreateTransaction()), | |
| 54 buffer_(new net::IOBuffer(kBufferSize)), | 53 buffer_(new net::IOBuffer(kBufferSize)), |
| 55 ALLOW_THIS_IN_INITIALIZER_LIST( | 54 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 56 connect_callback_(this, &Client::OnConnectComplete)), | 55 connect_callback_(this, &Client::OnConnectComplete)), |
| 57 ALLOW_THIS_IN_INITIALIZER_LIST( | 56 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 58 read_callback_(this, &Client::OnReadComplete)) { | 57 read_callback_(this, &Client::OnReadComplete)) { |
| 58 int rv = factory->CreateTransaction(&transaction_); |
| 59 DCHECK_EQ(net::OK, rv); |
| 59 buffer_->AddRef(); | 60 buffer_->AddRef(); |
| 60 driver_->ClientStarted(); | 61 driver_->ClientStarted(); |
| 61 request_info_.url = url_; | 62 request_info_.url = url_; |
| 62 request_info_.method = "GET"; | 63 request_info_.method = "GET"; |
| 63 int state = transaction_->Start( | 64 int state = transaction_->Start( |
| 64 &request_info_, &connect_callback_, NULL); | 65 &request_info_, &connect_callback_, NULL); |
| 65 DCHECK(state == net::ERR_IO_PENDING); | 66 DCHECK(state == net::ERR_IO_PENDING); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 private: | 69 private: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 std::string name(table.GetRowName(index)); | 192 std::string name(table.GetRowName(index)); |
| 192 if (name.length() > 0) { | 193 if (name.length() > 0) { |
| 193 int value = table.GetRowValue(index); | 194 int value = table.GetRowValue(index); |
| 194 printf("%s:\t%d\n", name.c_str(), value); | 195 printf("%s:\t%d\n", name.c_str(), value); |
| 195 } | 196 } |
| 196 } | 197 } |
| 197 printf("</stats>\n"); | 198 printf("</stats>\n"); |
| 198 } | 199 } |
| 199 return 0; | 200 return 0; |
| 200 } | 201 } |
| OLD | NEW |