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

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

Issue 10831277: [net] Change factory methods for HostResolver and HostCache to return a scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary initialization; respond to review Created 8 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
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 28 matching lines...) Expand all
39 bool TestClient::Start(const HostPortPair& server_host_port_pair, 39 bool TestClient::Start(const HostPortPair& server_host_port_pair,
40 int bytes_to_send, 40 int bytes_to_send,
41 const CompletionCallback& callback) { 41 const CompletionCallback& callback) {
42 DCHECK(!socket_); 42 DCHECK(!socket_);
43 DCHECK(finished_callback_.is_null()); 43 DCHECK(finished_callback_.is_null());
44 44
45 finished_callback_ = callback; 45 finished_callback_ = callback;
46 bytes_to_read_ = bytes_to_send_ = bytes_to_send; 46 bytes_to_read_ = bytes_to_send_ = bytes_to_send;
47 47
48 scoped_ptr<HostResolver> system_host_resolver( 48 scoped_ptr<HostResolver> system_host_resolver(
49 CreateSystemHostResolver(1, 0, NULL)); 49 HostResolver::CreateDefaultResolver(NULL));
50 SingleRequestHostResolver host_resolver(system_host_resolver.get()); 50 SingleRequestHostResolver host_resolver(system_host_resolver.get());
51 HostResolver::RequestInfo request(server_host_port_pair); 51 HostResolver::RequestInfo request(server_host_port_pair);
52 AddressList addresses; 52 AddressList addresses;
53 int rv = host_resolver.Resolve(request, &addresses, CompletionCallback(), 53 int rv = host_resolver.Resolve(request, &addresses, CompletionCallback(),
54 BoundNetLog()); 54 BoundNetLog());
55 if (rv != OK) { 55 if (rv != OK) {
56 LOG(ERROR) << "Could not resolve host"; 56 LOG(ERROR) << "Could not resolve host";
57 return false; 57 return false;
58 } 58 }
59 59
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void TestClient::Finish(int result) { 168 void TestClient::Finish(int result) {
169 DCHECK(!finished_callback_.is_null()); 169 DCHECK(!finished_callback_.is_null());
170 170
171 LOG(ERROR) << "TestClient Done!"; 171 LOG(ERROR) << "TestClient Done!";
172 CompletionCallback callback = finished_callback_; 172 CompletionCallback callback = finished_callback_;
173 finished_callback_.Reset(); 173 finished_callback_.Reset();
174 callback.Run(result); 174 callback.Run(result);
175 } 175 }
176 176
177 } // namespace net 177 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mapped_host_resolver_unittest.cc ('k') | net/proxy/proxy_script_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698