| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "base/stats_counters.h" | 9 #include "base/stats_counters.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 transaction_(factory->CreateTransaction()), | 50 transaction_(factory->CreateTransaction()), |
| 51 buffer_(new net::IOBuffer(kBufferSize)), | 51 buffer_(new net::IOBuffer(kBufferSize)), |
| 52 ALLOW_THIS_IN_INITIALIZER_LIST( | 52 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 53 connect_callback_(this, &Client::OnConnectComplete)), | 53 connect_callback_(this, &Client::OnConnectComplete)), |
| 54 ALLOW_THIS_IN_INITIALIZER_LIST( | 54 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 55 read_callback_(this, &Client::OnReadComplete)) { | 55 read_callback_(this, &Client::OnReadComplete)) { |
| 56 buffer_->AddRef(); | 56 buffer_->AddRef(); |
| 57 driver_->ClientStarted(); | 57 driver_->ClientStarted(); |
| 58 request_info_.url = url_; | 58 request_info_.url = url_; |
| 59 request_info_.method = "GET"; | 59 request_info_.method = "GET"; |
| 60 int state = transaction_->Start(&request_info_, &connect_callback_); | 60 int state = transaction_->Start( |
| 61 NULL, &request_info_, &connect_callback_); |
| 61 DCHECK(state == net::ERR_IO_PENDING); | 62 DCHECK(state == net::ERR_IO_PENDING); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 void OnConnectComplete(int result) { | 66 void OnConnectComplete(int result) { |
| 66 // Do work here. | 67 // Do work here. |
| 67 int state = transaction_->Read(buffer_.get(), kBufferSize, &read_callback_); | 68 int state = transaction_->Read(buffer_.get(), kBufferSize, &read_callback_); |
| 68 if (state == net::ERR_IO_PENDING) | 69 if (state == net::ERR_IO_PENDING) |
| 69 return; // IO has started. | 70 return; // IO has started. |
| 70 if (state < 0) | 71 if (state < 0) |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 std::string name(table.GetRowName(index)); | 184 std::string name(table.GetRowName(index)); |
| 184 if (name.length() > 0) { | 185 if (name.length() > 0) { |
| 185 int value = table.GetRowValue(index); | 186 int value = table.GetRowValue(index); |
| 186 printf("%s:\t%d\n", name.c_str(), value); | 187 printf("%s:\t%d\n", name.c_str(), value); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 printf("</stats>\n"); | 190 printf("</stats>\n"); |
| 190 } | 191 } |
| 191 return 0; | 192 return 0; |
| 192 } | 193 } |
| OLD | NEW |