| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
| 10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (result != DnsResponse::DNS_PARSE_OK) | 72 if (result != DnsResponse::DNS_PARSE_OK) |
| 73 return DnsProbeRunner::FAILING; | 73 return DnsProbeRunner::FAILING; |
| 74 else if (addr_list.empty()) | 74 else if (addr_list.empty()) |
| 75 return DnsProbeRunner::INCORRECT; | 75 return DnsProbeRunner::INCORRECT; |
| 76 else | 76 else |
| 77 return DnsProbeRunner::CORRECT; | 77 return DnsProbeRunner::CORRECT; |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 DnsProbeRunner::DnsProbeRunner() : weak_factory_(this), result_(UNKNOWN) {} | 82 DnsProbeRunner::DnsProbeRunner() : result_(UNKNOWN), weak_factory_(this) {} |
| 83 | 83 |
| 84 DnsProbeRunner::~DnsProbeRunner() {} | 84 DnsProbeRunner::~DnsProbeRunner() {} |
| 85 | 85 |
| 86 void DnsProbeRunner::SetClient(scoped_ptr<net::DnsClient> client) { | 86 void DnsProbeRunner::SetClient(scoped_ptr<net::DnsClient> client) { |
| 87 client_ = client.Pass(); | 87 client_ = client.Pass(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void DnsProbeRunner::RunProbe(const base::Closure& callback) { | 90 void DnsProbeRunner::RunProbe(const base::Closure& callback) { |
| 91 DCHECK(!callback.is_null()); | 91 DCHECK(!callback.is_null()); |
| 92 DCHECK(client_.get()); | 92 DCHECK(client_.get()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DCHECK(!callback_.is_null()); | 143 DCHECK(!callback_.is_null()); |
| 144 DCHECK(!transaction_.get()); | 144 DCHECK(!transaction_.get()); |
| 145 | 145 |
| 146 // Clear callback in case it starts a new probe immediately. | 146 // Clear callback in case it starts a new probe immediately. |
| 147 const base::Closure callback = callback_; | 147 const base::Closure callback = callback_; |
| 148 callback_.Reset(); | 148 callback_.Reset(); |
| 149 callback.Run(); | 149 callback.Run(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace chrome_browser_net | 152 } // namespace chrome_browser_net |
| OLD | NEW |