| 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 "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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 static base::LazyInstance<Driver> g_driver = LAZY_INSTANCE_INITIALIZER; | 54 static base::LazyInstance<Driver> g_driver = LAZY_INSTANCE_INITIALIZER; |
| 55 | 55 |
| 56 // A network client | 56 // A network client |
| 57 class Client { | 57 class Client { |
| 58 public: | 58 public: |
| 59 Client(net::HttpTransactionFactory* factory, const std::string& url) : | 59 Client(net::HttpTransactionFactory* factory, const std::string& url) : |
| 60 url_(url), | 60 url_(url), |
| 61 buffer_(new net::IOBuffer(kBufferSize)) { | 61 buffer_(new net::IOBuffer(kBufferSize)) { |
| 62 int rv = factory->CreateTransaction(&transaction_); | 62 int rv = factory->CreateTransaction(&transaction_, NULL); |
| 63 DCHECK_EQ(net::OK, rv); | 63 DCHECK_EQ(net::OK, rv); |
| 64 buffer_->AddRef(); | 64 buffer_->AddRef(); |
| 65 g_driver.Get().ClientStarted(); | 65 g_driver.Get().ClientStarted(); |
| 66 request_info_.url = url_; | 66 request_info_.url = url_; |
| 67 request_info_.method = "GET"; | 67 request_info_.method = "GET"; |
| 68 int state = transaction_->Start( | 68 int state = transaction_->Start( |
| 69 &request_info_, | 69 &request_info_, |
| 70 base::Bind(&Client::OnConnectComplete, base::Unretained(this)), | 70 base::Bind(&Client::OnConnectComplete, base::Unretained(this)), |
| 71 net::BoundNetLog()); | 71 net::BoundNetLog()); |
| 72 DCHECK(state == net::ERR_IO_PENDING); | 72 DCHECK(state == net::ERR_IO_PENDING); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 std::string name(table.GetRowName(index)); | 216 std::string name(table.GetRowName(index)); |
| 217 if (name.length() > 0) { | 217 if (name.length() > 0) { |
| 218 int value = table.GetRowValue(index); | 218 int value = table.GetRowValue(index); |
| 219 printf("%s:\t%d\n", name.c_str(), value); | 219 printf("%s:\t%d\n", name.c_str(), value); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 printf("</stats>\n"); | 222 printf("</stats>\n"); |
| 223 } | 223 } |
| 224 return 0; | 224 return 0; |
| 225 } | 225 } |
| OLD | NEW |