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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/DEPS ('k') | net/dns/mojo_host_resolver_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/mojo_host_resolver_impl.h
diff --git a/net/dns/mojo_host_resolver_impl.h b/net/dns/mojo_host_resolver_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..aa359ef3e04b5166da5070ba6d168b43e0fba5a4
--- /dev/null
+++ b/net/dns/mojo_host_resolver_impl.h
@@ -0,0 +1,53 @@
+// 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_MOJO_HOST_RESOLVER_IMPL_H_
+#define NET_DNS_MOJO_HOST_RESOLVER_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 HostResolver 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 MojoHostResolverImpl : public interfaces::HostResolver {
+ public:
+ // |resolver| is expected to outlive |this|.
+ explicit MojoHostResolverImpl(net::HostResolver* resolver);
+ ~MojoHostResolverImpl() override;
+
+ private:
+ class Job;
+
+ // Removes |job| from the set of pending jobs, and deletes it.
+ void DeleteJob(Job* job);
+
+ // Overridden from net::interfaces::HostResolver:
+ void Resolve(interfaces::HostResolverRequestInfoPtr request_info,
+ interfaces::HostResolverRequestClientPtr client) override;
+
+ // Resolver for resolving incoming requests. Not owned.
+ net::HostResolver* resolver_;
+
+ // All pending jobs, so they can be cancelled when this service is destroyed.
+ // Owns all jobs.
+ std::set<Job*> pending_jobs_;
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoHostResolverImpl);
+};
+
+} // namespace net
+
+#endif // NET_DNS_MOJO_HOST_RESOLVER_IMPL_H_
« 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