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

Side by Side Diff: net/dns/host_resolver_impl_fuzzer.cc

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 run_loop_.reset(new base::RunLoop()); 166 run_loop_.reset(new base::RunLoop());
167 run_loop_->Run(); 167 run_loop_->Run();
168 run_loop_.reset(); 168 run_loop_.reset();
169 CHECK(!is_running_); 169 CHECK(!is_running_);
170 } 170 }
171 } 171 }
172 172
173 // Cancel the request, if not already completed. Otherwise, does nothing. 173 // Cancel the request, if not already completed. Otherwise, does nothing.
174 void Cancel() { 174 void Cancel() {
175 if (is_running_) 175 if (is_running_)
176 host_resolver_->CancelRequest(handle_); 176 handle_.reset();
177 is_running_ = false; 177 is_running_ = false;
178 } 178 }
179 179
180 net::HostResolver* host_resolver_; 180 net::HostResolver* host_resolver_;
181 net::FuzzedDataProvider* data_provider_; 181 net::FuzzedDataProvider* data_provider_;
182 std::vector<std::unique_ptr<DnsRequest>>* dns_requests_; 182 std::vector<std::unique_ptr<DnsRequest>>* dns_requests_;
183 183
184 net::HostResolver::RequestHandle handle_; 184 std::unique_ptr<net::HostResolver::Request> handle_;
185 net::AddressList address_list_; 185 net::AddressList address_list_;
186 186
187 bool is_running_; 187 bool is_running_;
188 188
189 std::unique_ptr<base::RunLoop> run_loop_; 189 std::unique_ptr<base::RunLoop> run_loop_;
190 190
191 DISALLOW_COPY_AND_ASSIGN(DnsRequest); 191 DISALLOW_COPY_AND_ASSIGN(DnsRequest);
192 }; 192 };
193 193
194 } // namespace 194 } // namespace
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 break; 230 break;
231 } 231 }
232 } 232 }
233 } 233 }
234 234
235 // Clean up any pending tasks, after deleting everything. 235 // Clean up any pending tasks, after deleting everything.
236 base::RunLoop().RunUntilIdle(); 236 base::RunLoop().RunUntilIdle();
237 237
238 return 0; 238 return 0;
239 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698