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

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: Address review comments. 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
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/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "net/interfaces/host_resolver_service.mojom.h"
14
15 namespace net {
16
17 class HostResolver;
18
19 // This is the implementation of the HostResolver Mojo interface.
20 // Inbound Mojo requests are sent to the HostResolver passed into the
21 // constructor. When destroyed, any outstanding resolver requests are cancelled.
22 // If a request's HostResolverRequestClient is shut down, the associated
23 // resolver request is cancelled.
24 class MojoHostResolverImpl
25 : public mojo::InterfaceImpl<interfaces::HostResolver> {
26 public:
27 // |resolver| is expected to outlive |this|.
28 explicit MojoHostResolverImpl(net::HostResolver* resolver);
29 ~MojoHostResolverImpl() override;
30
31 private:
32 class Job;
33
34 // Removes |job| from the set of pending jobs, and deletes it.
35 void DeleteJob(Job* job);
36
37 // Overridden from net::interfaces::HostResolver:
38 void Resolve(interfaces::HostResolverRequestInfoPtr request_info,
39 interfaces::HostResolverRequestClientPtr client) override;
40
41 // Resolver for resolving incoming requests. Not owned.
42 net::HostResolver* resolver_;
43
44 // All pending jobs, so they can be cancelled when this service is destroyed.
45 // Owns all jobs.
46 std::set<Job*> pending_jobs_;
47
48 base::ThreadChecker thread_checker_;
49 base::WeakPtrFactory<MojoHostResolverImpl> weak_factory_;
50
51 DISALLOW_COPY_AND_ASSIGN(MojoHostResolverImpl);
52 };
53
54 } // namespace net
55
56 #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') | net/dns/mojo_host_resolver_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698