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

Unified Diff: net/dns/dns_client.cc

Issue 1898033006: DNS: Add stubs for persisting data across restarts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix bad merge. Created 4 years, 5 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/dns_client.cc
diff --git a/net/dns/dns_client.cc b/net/dns/dns_client.cc
index 274cefa19d0af2c892ad5f6715cf838e15b1ceec..d4390ba490e2bc659c579c470f12d3f60978d1dc 100644
--- a/net/dns/dns_client.cc
+++ b/net/dns/dns_client.cc
@@ -21,6 +21,7 @@ namespace net {
namespace {
+#if !defined(OS_IOS)
Charlie Harrison 2016/07/26 13:49:42 Why is this necessary?
Julia Tuttle 2016/07/26 21:10:13 It's not! Fixed.
class DnsClientImpl : public DnsClient {
public:
DnsClientImpl(NetLog* net_log,
@@ -56,6 +57,18 @@ class DnsClientImpl : public DnsClient {
AddressSorter* GetAddressSorter() override { return address_sorter_.get(); }
+ std::unique_ptr<const base::Value> GetPersistentData() const override {
+ if (!session_)
+ return std::unique_ptr<const base::Value>();
+ return session_->GetPersistentData();
+ }
+
+ void ApplyPersistentData(const base::Value& data) override {
+ if (!session_)
+ return;
+ session_->ApplyPersistentData(data);
+ }
+
private:
scoped_refptr<DnsSession> session_;
std::unique_ptr<DnsTransactionFactory> factory_;
@@ -68,14 +81,26 @@ class DnsClientImpl : public DnsClient {
DISALLOW_COPY_AND_ASSIGN(DnsClientImpl);
};
+#endif // !defined(OS_IOS)
} // namespace
+void DnsClient::ApplyPersistentData(const base::Value& data) {}
+
+std::unique_ptr<const base::Value> DnsClient::GetPersistentData() const {
+ return std::unique_ptr<const base::Value>();
+}
+
// static
std::unique_ptr<DnsClient> DnsClient::CreateClient(NetLog* net_log) {
+#if !defined(OS_IOS)
return base::WrapUnique(
new DnsClientImpl(net_log, ClientSocketFactory::GetDefaultFactory(),
base::Bind(&base::RandInt)));
+#else // defined(OS_IOS)
+ NOTIMPLEMENTED();
+ return std::unique_ptr<DnsClient>(nullptr);
+#endif // defined(OS_IOS)
}
// static
@@ -83,8 +108,13 @@ std::unique_ptr<DnsClient> DnsClient::CreateClientForTesting(
NetLog* net_log,
ClientSocketFactory* socket_factory,
const RandIntCallback& rand_int_callback) {
+#if !defined(OS_IOS)
return base::WrapUnique(
new DnsClientImpl(net_log, socket_factory, rand_int_callback));
+#else // defined(OS_IOS)
+ NOTIMPLEMENTED();
+ return std::unique_ptr<DnsClient>(nullptr);
+#endif // defined(OS_IOS)
}
} // namespace net
« no previous file with comments | « net/dns/dns_client.h ('k') | net/dns/dns_session.h » ('j') | net/dns/host_resolver.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698