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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: net/dns/host_resolver_service_impl.h
diff --git a/net/dns/host_resolver_service_impl.h b/net/dns/host_resolver_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..50f0896461a050aae825186830712e9a65d7b670
--- /dev/null
+++ b/net/dns/host_resolver_service_impl.h
@@ -0,0 +1,57 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_DNS_HOST_RESOLVER_SERVICE_IMPL_H_
+#define NET_DNS_HOST_RESOLVER_SERVICE_IMPL_H_
+
+#include <set>
+
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
+#include "net/interfaces/host_resolver_service.mojom.h"
+
+namespace net {
+
+class HostResolver;
+
+// This is the implementation of the HostResolverService Mojo interface.
+// Inbound Mojo requests are sent to the HostResolver passed into the
+// constructor. When destroyed, any outstanding resolver requests are cancelled.
+// If a request's HostResolverRequestClient is shut down, the associated
+// resolver request is cancelled.
+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
+ : public mojo::InterfaceImpl<interfaces::HostResolverService> {
+ public:
+ 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.
+ ~HostResolverServiceImpl() override;
+
+ // Returns the number of outstanding requests.
+ // For testing only.
+ size_t OutstandingRequestsForTesting();
+
+ private:
+ class Job;
+
+ // Removes |job| from the set of pending jobs, and deletes it.
+ void DeleteJob(Job* job);
+
+ // Overridden from net::interfaces::HostResolverService:
+ void Resolve(interfaces::HostResolverRequestInfoPtr request_info,
+ interfaces::HostResolverRequestClientPtr client) override;
+
+ // Resolver for resolving incoming requests.
+ HostResolver* resolver_;
+
+ // All pending jobs, so they can be cancelled when this service is destroyed.
+ // Owns all jobs.
+ 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
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostResolverServiceImpl);
+};
+
+} // namespace net
+
+#endif // NET_DNS_HOST_RESOLVER_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698