| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/net/dns_probe_runner.h" | 5 #include "chrome/browser/net/dns_probe_runner.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 9 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
| 10 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.h" |
| 11 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 12 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 13 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
| 14 #include "net/dns/dns_client.h" | 16 #include "net/dns/dns_client.h" |
| 15 #include "net/dns/dns_protocol.h" | 17 #include "net/dns/dns_protocol.h" |
| 16 #include "net/dns/dns_response.h" | 18 #include "net/dns/dns_response.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return DnsProbeRunner::CORRECT; | 79 return DnsProbeRunner::CORRECT; |
| 78 } | 80 } |
| 79 | 81 |
| 80 } // namespace | 82 } // namespace |
| 81 | 83 |
| 82 DnsProbeRunner::DnsProbeRunner() : result_(UNKNOWN), weak_factory_(this) {} | 84 DnsProbeRunner::DnsProbeRunner() : result_(UNKNOWN), weak_factory_(this) {} |
| 83 | 85 |
| 84 DnsProbeRunner::~DnsProbeRunner() {} | 86 DnsProbeRunner::~DnsProbeRunner() {} |
| 85 | 87 |
| 86 void DnsProbeRunner::SetClient(scoped_ptr<net::DnsClient> client) { | 88 void DnsProbeRunner::SetClient(scoped_ptr<net::DnsClient> client) { |
| 87 client_ = client.Pass(); | 89 client_ = std::move(client); |
| 88 } | 90 } |
| 89 | 91 |
| 90 void DnsProbeRunner::RunProbe(const base::Closure& callback) { | 92 void DnsProbeRunner::RunProbe(const base::Closure& callback) { |
| 91 DCHECK(!callback.is_null()); | 93 DCHECK(!callback.is_null()); |
| 92 DCHECK(client_.get()); | 94 DCHECK(client_.get()); |
| 93 DCHECK(callback_.is_null()); | 95 DCHECK(callback_.is_null()); |
| 94 DCHECK(!transaction_.get()); | 96 DCHECK(!transaction_.get()); |
| 95 | 97 |
| 96 callback_ = callback; | 98 callback_ = callback; |
| 97 DnsTransactionFactory* factory = client_->GetTransactionFactory(); | 99 DnsTransactionFactory* factory = client_->GetTransactionFactory(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DCHECK(!callback_.is_null()); | 145 DCHECK(!callback_.is_null()); |
| 144 DCHECK(!transaction_.get()); | 146 DCHECK(!transaction_.get()); |
| 145 | 147 |
| 146 // Clear callback in case it starts a new probe immediately. | 148 // Clear callback in case it starts a new probe immediately. |
| 147 const base::Closure callback = callback_; | 149 const base::Closure callback = callback_; |
| 148 callback_.Reset(); | 150 callback_.Reset(); |
| 149 callback.Run(); | 151 callback.Run(); |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace chrome_browser_net | 154 } // namespace chrome_browser_net |
| OLD | NEW |