| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (data_provider_->ConsumeBool()) | 139 if (data_provider_->ConsumeBool()) |
| 140 info.set_host_resolver_flags(net::HOST_RESOLVER_CANONNAME); | 140 info.set_host_resolver_flags(net::HOST_RESOLVER_CANONNAME); |
| 141 | 141 |
| 142 net::RequestPriority priority = | 142 net::RequestPriority priority = |
| 143 static_cast<net::RequestPriority>(data_provider_->ConsumeInt32InRange( | 143 static_cast<net::RequestPriority>(data_provider_->ConsumeInt32InRange( |
| 144 net::MINIMUM_PRIORITY, net::MAXIMUM_PRIORITY)); | 144 net::MINIMUM_PRIORITY, net::MAXIMUM_PRIORITY)); |
| 145 | 145 |
| 146 // Decide if should be a cache-only resolution. | 146 // Decide if should be a cache-only resolution. |
| 147 if (data_provider_->ConsumeBool()) { | 147 if (data_provider_->ConsumeBool()) { |
| 148 return host_resolver_->ResolveFromCache(info, &address_list_, | 148 return host_resolver_->ResolveFromCache(info, &address_list_, |
| 149 net::BoundNetLog()); | 149 net::NetLogWithSource()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 info.set_allow_cached_response(data_provider_->ConsumeBool()); | 152 info.set_allow_cached_response(data_provider_->ConsumeBool()); |
| 153 return host_resolver_->Resolve( | 153 return host_resolver_->Resolve( |
| 154 info, priority, &address_list_, | 154 info, priority, &address_list_, |
| 155 base::Bind(&DnsRequest::OnCallback, base::Unretained(this)), &request_, | 155 base::Bind(&DnsRequest::OnCallback, base::Unretained(this)), &request_, |
| 156 net::BoundNetLog()); | 156 net::NetLogWithSource()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Waits until the request is done, if it isn't done already. | 159 // Waits until the request is done, if it isn't done already. |
| 160 void WaitUntilDone() { | 160 void WaitUntilDone() { |
| 161 CHECK(!run_loop_); | 161 CHECK(!run_loop_); |
| 162 if (is_running_) { | 162 if (is_running_) { |
| 163 run_loop_.reset(new base::RunLoop()); | 163 run_loop_.reset(new base::RunLoop()); |
| 164 run_loop_->Run(); | 164 run_loop_->Run(); |
| 165 run_loop_.reset(); | 165 run_loop_.reset(); |
| 166 DCHECK(request_); | 166 DCHECK(request_); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Clean up any pending tasks, after deleting everything. | 231 // Clean up any pending tasks, after deleting everything. |
| 232 base::RunLoop().RunUntilIdle(); | 232 base::RunLoop().RunUntilIdle(); |
| 233 | 233 |
| 234 return 0; | 234 return 0; |
| 235 } | 235 } |
| OLD | NEW |