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

Unified Diff: net/dns/host_resolver_mojo.h

Issue 904313003: Implement utility-side host resolver Mojo client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-proxy-resolver
Patch 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/BUILD.gn ('k') | net/dns/host_resolver_mojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_mojo.h
diff --git a/net/dns/host_resolver_mojo.h b/net/dns/host_resolver_mojo.h
new file mode 100644
index 0000000000000000000000000000000000000000..d250b969a927c7775d78ab22303900fafa510cf4
--- /dev/null
+++ b/net/dns/host_resolver_mojo.h
@@ -0,0 +1,55 @@
+// 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_MOJO_H_
+#define NET_DNS_HOST_RESOLVER_MOJO_H_
+
+#include "base/callback.h"
+#include "base/threading/thread_checker.h"
+#include "net/dns/host_resolver.h"
+#include "net/interfaces/host_resolver_service.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
+
+namespace net {
+class AddressList;
+class BoundNetLog;
+
+// A HostResolver implementation that delegates to an interfaces::HostResolver
+// mojo interface.
+class HostResolverMojo : public HostResolver, public mojo::ErrorHandler {
+ public:
+ HostResolverMojo(interfaces::HostResolverPtr resolver,
+ const base::Closure& disconnect_callback);
+ ~HostResolverMojo() override;
+
+ // HostResolver overrides.
+ int Resolve(const RequestInfo& info,
+ RequestPriority priority,
+ AddressList* addresses,
+ const CompletionCallback& callback,
+ RequestHandle* request_handle,
+ const BoundNetLog& source_net_log) override;
+ int ResolveFromCache(const RequestInfo& info,
+ AddressList* addresses,
+ const BoundNetLog& source_net_log) override;
+ void CancelRequest(RequestHandle req) override;
+
+ private:
+ class Job;
+
+ // mojo::ErrorHandler override.
+ void OnConnectionError() override;
+
+ interfaces::HostResolverPtr resolver_;
+
+ const base::Closure disconnect_callback_;
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostResolverMojo);
+};
+
+} // namespace net
+
+#endif // NET_DNS_HOST_RESOLVER_MOJO_H_
« no previous file with comments | « net/BUILD.gn ('k') | net/dns/host_resolver_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698