| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 unsigned replay_log_index_; | 224 unsigned replay_log_index_; |
| 225 base::Time start_time_; | 225 base::Time start_time_; |
| 226 int active_resolves_; | 226 int active_resolves_; |
| 227 Result result_; | 227 Result result_; |
| 228 | 228 |
| 229 base::CancelableClosure timeout_closure_; | 229 base::CancelableClosure timeout_closure_; |
| 230 std::unique_ptr<DnsConfigService> dns_config_service_; | 230 std::unique_ptr<DnsConfigService> dns_config_service_; |
| 231 std::unique_ptr<FileNetLogObserver> log_observer_; | 231 std::unique_ptr<FileNetLogObserver> log_observer_; |
| 232 std::unique_ptr<NetLog> log_; | 232 std::unique_ptr<NetLog> log_; |
| 233 std::unique_ptr<HostResolver> resolver_; | 233 std::unique_ptr<HostResolver> resolver_; |
| 234 std::unique_ptr<HostResolver::Request> request_; |
| 234 | 235 |
| 235 #if defined(OS_MACOSX) | 236 #if defined(OS_MACOSX) |
| 236 // Without this there will be a mem leak on osx. | 237 // Without this there will be a mem leak on osx. |
| 237 base::mac::ScopedNSAutoreleasePool scoped_pool_; | 238 base::mac::ScopedNSAutoreleasePool scoped_pool_; |
| 238 #endif | 239 #endif |
| 239 | 240 |
| 240 // Need AtExitManager to support AsWeakPtr (in NetLog). | 241 // Need AtExitManager to support AsWeakPtr (in NetLog). |
| 241 base::AtExitManager exit_manager_; | 242 base::AtExitManager exit_manager_; |
| 242 }; | 243 }; |
| 243 | 244 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 AddressList* addrlist = new AddressList(); | 462 AddressList* addrlist = new AddressList(); |
| 462 unsigned current_index = replay_log_index_; | 463 unsigned current_index = replay_log_index_; |
| 463 CompletionCallback callback = base::Bind(&GDig::OnResolveComplete, | 464 CompletionCallback callback = base::Bind(&GDig::OnResolveComplete, |
| 464 base::Unretained(this), | 465 base::Unretained(this), |
| 465 current_index, | 466 current_index, |
| 466 base::Owned(addrlist), | 467 base::Owned(addrlist), |
| 467 time_since_start); | 468 time_since_start); |
| 468 ++active_resolves_; | 469 ++active_resolves_; |
| 469 ++replay_log_index_; | 470 ++replay_log_index_; |
| 470 int ret = resolver_->Resolve( | 471 int ret = resolver_->Resolve( |
| 471 info, | 472 info, DEFAULT_PRIORITY, addrlist, callback, &request_, |
| 472 DEFAULT_PRIORITY, | |
| 473 addrlist, | |
| 474 callback, | |
| 475 NULL, | |
| 476 BoundNetLog::Make(log_.get(), net::NetLog::SOURCE_NONE)); | 473 BoundNetLog::Make(log_.get(), net::NetLog::SOURCE_NONE)); |
| 477 if (ret != ERR_IO_PENDING) | 474 if (ret != ERR_IO_PENDING) |
| 478 callback.Run(ret); | 475 callback.Run(ret); |
| 479 } | 476 } |
| 480 } | 477 } |
| 481 | 478 |
| 482 void GDig::OnResolveComplete(unsigned entry_index, | 479 void GDig::OnResolveComplete(unsigned entry_index, |
| 483 AddressList* address_list, | 480 AddressList* address_list, |
| 484 base::TimeDelta resolve_start_time, | 481 base::TimeDelta resolve_start_time, |
| 485 int val) { | 482 int val) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 515 } | 512 } |
| 516 | 513 |
| 517 } // empty namespace | 514 } // empty namespace |
| 518 | 515 |
| 519 } // namespace net | 516 } // namespace net |
| 520 | 517 |
| 521 int main(int argc, const char* argv[]) { | 518 int main(int argc, const char* argv[]) { |
| 522 net::GDig dig; | 519 net::GDig dig; |
| 523 return dig.Main(argc, argv); | 520 return dig.Main(argc, argv); |
| 524 } | 521 } |
| OLD | NEW |