Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ | |
| 6 #define NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/threading/thread_checker.h" | |
| 12 #include "net/interfaces/host_resolver_service.mojom.h" | |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 class HostResolver; | |
| 17 | |
| 18 // This is the implementation of the HostResolver Mojo interface. | |
| 19 // Inbound Mojo requests are sent to the HostResolver passed into the | |
| 20 // constructor. When destroyed, any outstanding resolver requests are cancelled. | |
| 21 // If a request's HostResolverRequestClient is shut down, the associated | |
| 22 // resolver request is cancelled. | |
| 23 class MojoHostResolverImpl | |
| 24 : public mojo::InterfaceImpl<interfaces::HostResolver> { | |
|
jamesr
2015/02/12 18:23:11
InterfaceImpl is deprecated (hence the DEPRECATED
Anand Mistry (off Chromium)
2015/02/12 22:54:09
Oops. Actually, we do use Binding<>. Not sure why
| |
| 25 public: | |
| 26 // |resolver| is expected to outlive |this|. | |
| 27 explicit MojoHostResolverImpl(net::HostResolver* resolver); | |
| 28 ~MojoHostResolverImpl() override; | |
| 29 | |
| 30 private: | |
| 31 class Job; | |
| 32 | |
| 33 // Removes |job| from the set of pending jobs, and deletes it. | |
| 34 void DeleteJob(Job* job); | |
| 35 | |
| 36 // Overridden from net::interfaces::HostResolver: | |
| 37 void Resolve(interfaces::HostResolverRequestInfoPtr request_info, | |
| 38 interfaces::HostResolverRequestClientPtr client) override; | |
| 39 | |
| 40 // Resolver for resolving incoming requests. Not owned. | |
| 41 net::HostResolver* resolver_; | |
| 42 | |
| 43 // All pending jobs, so they can be cancelled when this service is destroyed. | |
| 44 // Owns all jobs. | |
| 45 std::set<Job*> pending_jobs_; | |
| 46 | |
| 47 base::ThreadChecker thread_checker_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(MojoHostResolverImpl); | |
| 50 }; | |
| 51 | |
| 52 } // namespace net | |
| 53 | |
| 54 #endif // NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_ | |
| OLD | NEW |