Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ | 5 #ifndef NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ |
| 6 #define NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ | 6 #define NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <list> |
|
mmenke
2016/11/11 16:18:03
While you're here, mind adding <memory>?
davidben
2016/12/08 21:12:02
Done.
| |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "net/interfaces/host_resolver_service.mojom.h" | 12 #include "net/interfaces/host_resolver_service.mojom.h" |
| 13 #include "net/log/net_log_with_source.h" | 13 #include "net/log/net_log_with_source.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class HostResolver; | 17 class HostResolver; |
| 18 | 18 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 29 ~MojoHostResolverImpl(); | 29 ~MojoHostResolverImpl(); |
| 30 | 30 |
| 31 void Resolve(std::unique_ptr<HostResolver::RequestInfo> request_info, | 31 void Resolve(std::unique_ptr<HostResolver::RequestInfo> request_info, |
| 32 interfaces::HostResolverRequestClientPtr client); | 32 interfaces::HostResolverRequestClientPtr client); |
| 33 | 33 |
| 34 bool request_in_progress() { return !pending_jobs_.empty(); } | 34 bool request_in_progress() { return !pending_jobs_.empty(); } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 class Job; | 37 class Job; |
| 38 | 38 |
| 39 // Removes |job| from the set of pending jobs, and deletes it. | 39 // Removes |job| from the set of pending jobs. |
| 40 void DeleteJob(Job* job); | 40 void DeleteJob(std::list<Job>::iterator job); |
| 41 | 41 |
| 42 // Resolver for resolving incoming requests. Not owned. | 42 // Resolver for resolving incoming requests. Not owned. |
| 43 net::HostResolver* resolver_; | 43 net::HostResolver* resolver_; |
| 44 | 44 |
| 45 // The NetLogWithSource to be passed to |resolver_| for all requests. | 45 // The NetLogWithSource to be passed to |resolver_| for all requests. |
| 46 const NetLogWithSource net_log_; | 46 const NetLogWithSource net_log_; |
| 47 | 47 |
| 48 // All pending jobs, so they can be cancelled when this service is destroyed. | 48 // All pending jobs, so they can be cancelled when this service is destroyed. |
| 49 // Owns all jobs. | 49 std::list<Job> pending_jobs_; |
| 50 std::set<Job*> pending_jobs_; | |
| 51 | 50 |
| 52 base::ThreadChecker thread_checker_; | 51 base::ThreadChecker thread_checker_; |
| 53 | 52 |
| 54 DISALLOW_COPY_AND_ASSIGN(MojoHostResolverImpl); | 53 DISALLOW_COPY_AND_ASSIGN(MojoHostResolverImpl); |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 } // namespace net | 56 } // namespace net |
| 58 | 57 |
| 59 #endif // NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ | 58 #endif // NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ |
| OLD | NEW |