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

Side by Side Diff: net/curvecp/test_client.cc

Issue 8549004: base::Bind: Convert HostResolver::Resolve. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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 | « net/base/single_request_host_resolver_unittest.cc ('k') | net/dns/async_host_resolver.h » ('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 "net/curvecp/test_client.h" 5 #include "net/curvecp/test_client.h"
6 6
7 #include <string> 7 #include <string>
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 DCHECK(!finished_callback_); 50 DCHECK(!finished_callback_);
51 51
52 finished_callback_ = callback; 52 finished_callback_ = callback;
53 bytes_to_read_ = bytes_to_send_ = bytes_to_send; 53 bytes_to_read_ = bytes_to_send_ = bytes_to_send;
54 54
55 scoped_ptr<HostResolver> system_host_resolver( 55 scoped_ptr<HostResolver> system_host_resolver(
56 CreateSystemHostResolver(1, 0, NULL)); 56 CreateSystemHostResolver(1, 0, NULL));
57 SingleRequestHostResolver host_resolver(system_host_resolver.get()); 57 SingleRequestHostResolver host_resolver(system_host_resolver.get());
58 HostResolver::RequestInfo request(server_host_port_pair); 58 HostResolver::RequestInfo request(server_host_port_pair);
59 AddressList addresses; 59 AddressList addresses;
60 int rv = host_resolver.Resolve(request, &addresses, NULL, BoundNetLog()); 60 int rv = host_resolver.Resolve(request, &addresses, CompletionCallback(),
61 BoundNetLog());
61 if (rv != OK) { 62 if (rv != OK) {
62 LOG(ERROR) << "Could not resolve host"; 63 LOG(ERROR) << "Could not resolve host";
63 return false; 64 return false;
64 } 65 }
65 66
66 socket_ = new CurveCPClientSocket(addresses, NULL, NetLog::Source()); 67 socket_ = new CurveCPClientSocket(addresses, NULL, NetLog::Source());
67 rv = socket_->Connect(&connect_callback_); 68 rv = socket_->Connect(&connect_callback_);
68 if (rv == ERR_IO_PENDING) 69 if (rv == ERR_IO_PENDING)
69 return true; 70 return true;
70 OnConnectComplete(rv); 71 OnConnectComplete(rv);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void TestClient::Finish(int result) { 171 void TestClient::Finish(int result) {
171 DCHECK(finished_callback_); 172 DCHECK(finished_callback_);
172 173
173 LOG(ERROR) << "TestClient Done!"; 174 LOG(ERROR) << "TestClient Done!";
174 OldCompletionCallback* callback = finished_callback_; 175 OldCompletionCallback* callback = finished_callback_;
175 finished_callback_ = NULL; 176 finished_callback_ = NULL;
176 callback->Run(result); 177 callback->Run(result);
177 } 178 }
178 179
179 } // namespace net 180 } // namespace net
OLDNEW
« no previous file with comments | « net/base/single_request_host_resolver_unittest.cc ('k') | net/dns/async_host_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698