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

Side by Side Diff: net/dns/host_resolver_service_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: Windows? Again! 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_HOST_RESOLVER_SERVICE_IMPL_H_
6 #define NET_DNS_HOST_RESOLVER_SERVICE_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 HostResolverService 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 HostResolverServiceImpl
eroman 2015/02/05 19:51:11 I am not excited about the naming. "Service" is al
Anand Mistry (off Chromium) 2015/02/06 06:32:40 https://memegen.googleplex.com/14366727 https://me
24 : public mojo::InterfaceImpl<interfaces::HostResolverService> {
25 public:
26 explicit HostResolverServiceImpl(HostResolver* resolver);
eroman 2015/02/05 19:51:11 Please describe the lifetime expectations for |res
Anand Mistry (off Chromium) 2015/02/06 06:32:41 Done.
27 ~HostResolverServiceImpl() override;
28
29 // Returns the number of outstanding requests.
30 // For testing only.
31 size_t OutstandingRequestsForTesting();
32
33 private:
34 class Job;
35
36 // Removes |job| from the set of pending jobs, and deletes it.
37 void DeleteJob(Job* job);
38
39 // Overridden from net::interfaces::HostResolverService:
40 void Resolve(interfaces::HostResolverRequestInfoPtr request_info,
41 interfaces::HostResolverRequestClientPtr client) override;
42
43 // Resolver for resolving incoming requests.
44 HostResolver* resolver_;
45
46 // All pending jobs, so they can be cancelled when this service is destroyed.
47 // Owns all jobs.
48 std::set<Job*> pending_jobs_;
Sam McNally 2015/02/05 23:58:36 std::set<linked_ptr<Job>>
Anand Mistry (off Chromium) 2015/02/06 06:32:40 I tried that, but it ended up being fairly convolu
49
50 base::ThreadChecker thread_checker_;
51
52 DISALLOW_COPY_AND_ASSIGN(HostResolverServiceImpl);
53 };
54
55 } // namespace net
56
57 #endif // NET_DNS_HOST_RESOLVER_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698