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

Side by Side Diff: net/tools/gdig/gdig.cc

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 months 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
« no previous file with comments | « net/tools/gdig/file_net_log.cc ('k') | net/tools/get_server_time/get_server_time.cc » ('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) 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 <stdio.h> 5 #include <stdio.h>
6
7 #include <memory>
6 #include <string> 8 #include <string>
7 #include <utility> 9 #include <utility>
8 10
9 #include "base/at_exit.h" 11 #include "base/at_exit.h"
10 #include "base/bind.h" 12 #include "base/bind.h"
11 #include "base/cancelable_callback.h" 13 #include "base/cancelable_callback.h"
12 #include "base/command_line.h" 14 #include "base/command_line.h"
13 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
14 #include "base/location.h" 16 #include "base/location.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
17 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
20 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
23 #include "base/thread_task_runner_handle.h" 24 #include "base/thread_task_runner_handle.h"
24 #include "base/time/time.h" 25 #include "base/time/time.h"
25 #include "net/base/address_list.h" 26 #include "net/base/address_list.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 net::IPEndPoint nameserver_; 219 net::IPEndPoint nameserver_;
219 base::TimeDelta timeout_; 220 base::TimeDelta timeout_;
220 int parallellism_; 221 int parallellism_;
221 ReplayLog replay_log_; 222 ReplayLog replay_log_;
222 unsigned replay_log_index_; 223 unsigned replay_log_index_;
223 base::Time start_time_; 224 base::Time start_time_;
224 int active_resolves_; 225 int active_resolves_;
225 Result result_; 226 Result result_;
226 227
227 base::CancelableClosure timeout_closure_; 228 base::CancelableClosure timeout_closure_;
228 scoped_ptr<DnsConfigService> dns_config_service_; 229 std::unique_ptr<DnsConfigService> dns_config_service_;
229 scoped_ptr<FileNetLogObserver> log_observer_; 230 std::unique_ptr<FileNetLogObserver> log_observer_;
230 scoped_ptr<NetLog> log_; 231 std::unique_ptr<NetLog> log_;
231 scoped_ptr<HostResolver> resolver_; 232 std::unique_ptr<HostResolver> resolver_;
232 233
233 #if defined(OS_MACOSX) 234 #if defined(OS_MACOSX)
234 // Without this there will be a mem leak on osx. 235 // Without this there will be a mem leak on osx.
235 base::mac::ScopedNSAutoreleasePool scoped_pool_; 236 base::mac::ScopedNSAutoreleasePool scoped_pool_;
236 #endif 237 #endif
237 238
238 // Need AtExitManager to support AsWeakPtr (in NetLog). 239 // Need AtExitManager to support AsWeakPtr (in NetLog).
239 base::AtExitManager exit_manager_; 240 base::AtExitManager exit_manager_;
240 }; 241 };
241 242
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (print_hosts_) { 420 if (print_hosts_) {
420 printf("# Host Database\n" 421 printf("# Host Database\n"
421 "%s", DnsHostsToString(dns_config.hosts).c_str()); 422 "%s", DnsHostsToString(dns_config.hosts).c_str());
422 } 423 }
423 424
424 if (replay_log_.empty()) { 425 if (replay_log_.empty()) {
425 Finish(RESULT_OK); 426 Finish(RESULT_OK);
426 return; 427 return;
427 } 428 }
428 429
429 scoped_ptr<DnsClient> dns_client(DnsClient::CreateClient(NULL)); 430 std::unique_ptr<DnsClient> dns_client(DnsClient::CreateClient(NULL));
430 dns_client->SetConfig(dns_config); 431 dns_client->SetConfig(dns_config);
431 HostResolver::Options options; 432 HostResolver::Options options;
432 options.max_concurrent_resolves = parallellism_; 433 options.max_concurrent_resolves = parallellism_;
433 options.max_retry_attempts = 1u; 434 options.max_retry_attempts = 1u;
434 scoped_ptr<HostResolverImpl> resolver( 435 std::unique_ptr<HostResolverImpl> resolver(
435 new HostResolverImpl(options, log_.get())); 436 new HostResolverImpl(options, log_.get()));
436 resolver->SetDnsClient(std::move(dns_client)); 437 resolver->SetDnsClient(std::move(dns_client));
437 resolver_ = std::move(resolver); 438 resolver_ = std::move(resolver);
438 439
439 start_time_ = base::Time::Now(); 440 start_time_ = base::Time::Now();
440 441
441 ReplayNextEntry(); 442 ReplayNextEntry();
442 } 443 }
443 444
444 void GDig::ReplayNextEntry() { 445 void GDig::ReplayNextEntry() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 514 }
514 515
515 } // empty namespace 516 } // empty namespace
516 517
517 } // namespace net 518 } // namespace net
518 519
519 int main(int argc, const char* argv[]) { 520 int main(int argc, const char* argv[]) {
520 net::GDig dig; 521 net::GDig dig;
521 return dig.Main(argc, argv); 522 return dig.Main(argc, argv);
522 } 523 }
OLDNEW
« no previous file with comments | « net/tools/gdig/file_net_log.cc ('k') | net/tools/get_server_time/get_server_time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698