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 "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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 connect_callback_(this, &Client::OnConnectComplete)), | 56 connect_callback_(this, &Client::OnConnectComplete)), |
57 ALLOW_THIS_IN_INITIALIZER_LIST( | 57 ALLOW_THIS_IN_INITIALIZER_LIST( |
58 read_callback_(this, &Client::OnReadComplete)) { | 58 read_callback_(this, &Client::OnReadComplete)) { |
59 int rv = factory->CreateTransaction(&transaction_); | 59 int rv = factory->CreateTransaction(&transaction_); |
60 DCHECK_EQ(net::OK, rv); | 60 DCHECK_EQ(net::OK, rv); |
61 buffer_->AddRef(); | 61 buffer_->AddRef(); |
62 driver_->ClientStarted(); | 62 driver_->ClientStarted(); |
63 request_info_.url = url_; | 63 request_info_.url = url_; |
64 request_info_.method = "GET"; | 64 request_info_.method = "GET"; |
65 int state = transaction_->Start( | 65 int state = transaction_->Start( |
66 &request_info_, &connect_callback_, NULL); | 66 &request_info_, &connect_callback_, net::BoundNetLog()); |
67 DCHECK(state == net::ERR_IO_PENDING); | 67 DCHECK(state == net::ERR_IO_PENDING); |
68 }; | 68 }; |
69 | 69 |
70 private: | 70 private: |
71 void OnConnectComplete(int result) { | 71 void OnConnectComplete(int result) { |
72 // Do work here. | 72 // Do work here. |
73 int state = transaction_->Read(buffer_.get(), kBufferSize, &read_callback_); | 73 int state = transaction_->Read(buffer_.get(), kBufferSize, &read_callback_); |
74 if (state == net::ERR_IO_PENDING) | 74 if (state == net::ERR_IO_PENDING) |
75 return; // IO has started. | 75 return; // IO has started. |
76 if (state < 0) | 76 if (state < 0) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 std::string name(table.GetRowName(index)); | 195 std::string name(table.GetRowName(index)); |
196 if (name.length() > 0) { | 196 if (name.length() > 0) { |
197 int value = table.GetRowValue(index); | 197 int value = table.GetRowValue(index); |
198 printf("%s:\t%d\n", name.c_str(), value); | 198 printf("%s:\t%d\n", name.c_str(), value); |
199 } | 199 } |
200 } | 200 } |
201 printf("</stats>\n"); | 201 printf("</stats>\n"); |
202 } | 202 } |
203 return 0; | 203 return 0; |
204 } | 204 } |
OLD | NEW |