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

Side by Side Diff: net/dns/mojo_host_resolver_impl.h

Issue 892393005: Implement browser-side host resolver Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-pac-interfaces
Patch Set: Change static_library to source_set. Created 5 years, 10 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
« no previous file with comments | « net/DEPS ('k') | net/dns/mojo_host_resolver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 : public interfaces::HostResolver {
24 public:
25 // |resolver| is expected to outlive |this|.
26 explicit MojoHostResolverImpl(net::HostResolver* resolver);
27 ~MojoHostResolverImpl() override;
28
29 private:
30 class Job;
31
32 // Removes |job| from the set of pending jobs, and deletes it.
33 void DeleteJob(Job* job);
34
35 // Overridden from net::interfaces::HostResolver:
36 void Resolve(interfaces::HostResolverRequestInfoPtr request_info,
37 interfaces::HostResolverRequestClientPtr client) override;
38
39 // Resolver for resolving incoming requests. Not owned.
40 net::HostResolver* resolver_;
41
42 // All pending jobs, so they can be cancelled when this service is destroyed.
43 // Owns all jobs.
44 std::set<Job*> pending_jobs_;
45
46 base::ThreadChecker thread_checker_;
47
48 DISALLOW_COPY_AND_ASSIGN(MojoHostResolverImpl);
49 };
50
51 } // namespace net
52
53 #endif // NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_
OLDNEW
« no previous file with comments | « net/DEPS ('k') | net/dns/mojo_host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698