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

Unified Diff: net/dns/stale_host_resolver.h

Issue 1898873006: Cronet: Use stale DNS cache entries experimentally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dns_stale2
Patch Set: rebase Created 4 years, 8 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 | « no previous file | net/dns/stale_host_resolver.cc » ('j') | net/dns/stale_host_resolver.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/stale_host_resolver.h
diff --git a/net/dns/stale_host_resolver.h b/net/dns/stale_host_resolver.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9b8810b58e8b95a449f3f18681b3f8044180df5
--- /dev/null
+++ b/net/dns/stale_host_resolver.h
@@ -0,0 +1,56 @@
+// Copyright 2016 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_STALE_HOST_RESOLVER_H_
+#define NET_DNS_STALE_HOST_RESOLVER_H_
+
+#include "net/dns/host_resolver.h"
+
+namespace net {
+
+class NET_EXPORT StaleHostResolver : public HostResolver {
Ryan Sleevi 2016/04/26 02:25:36 Document (throughout this file; methods & class)
Julia Tuttle 2016/04/27 14:50:26 Done.
+ public:
+ struct NET_EXPORT StaleOptions {
+ base::TimeDelta delay;
+ base::TimeDelta max_expired_time;
+ bool allow_other_network;
+ unsigned max_stale_uses;
+ };
+
+ StaleHostResolver(std::unique_ptr<HostResolver> inner_resolver,
+ const StaleOptions& stale_options);
+
+ ~StaleHostResolver() override;
+
+ int Resolve(const RequestInfo& info,
+ RequestPriority priority,
+ AddressList* addresses,
+ const CompletionCallback& callback,
+ RequestHandle* out_req,
+ const BoundNetLog& net_log) override;
+
+ void CancelRequest(RequestHandle req) override;
+
+ // Pass through to the inner resolver:
+ int ResolveFromCache(const RequestInfo& info,
+ AddressList* addresses,
+ const BoundNetLog& net_log) override;
+ int ResolveStaleFromCache(const RequestInfo& info,
+ AddressList* addresses,
+ HostCache::StaleEntryInfo* stale_info,
+ const BoundNetLog& net_log) override;
+ void SetDnsClientEnabled(bool enabled) override;
+ HostCache* GetHostCache() override;
+ std::unique_ptr<base::Value> GetDnsConfigAsValue() const override;
+
+ private:
+ class Request;
+
+ std::unique_ptr<HostResolver> resolver_;
+ StaleOptions options_;
+};
+
+} // namespace net
+
+#endif // NET_DNS_STALE_HOST_RESOLVER_H_
« no previous file with comments | « no previous file | net/dns/stale_host_resolver.cc » ('j') | net/dns/stale_host_resolver.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698