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

Unified Diff: net/dns/host_resolver_impl.h

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/host_resolver_impl.h
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index 9ab01ca03ea1a6d3ea4a828249d546537a127f4f..d67b553b2aabcac1f52571ba32cfac0545e098b8 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -16,6 +16,7 @@
#include "base/strings/string_piece.h"
#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "net/base/net_export.h"
#include "net/base/network_change_notifier.h"
#include "net/dns/host_cache.h"
@@ -156,6 +157,10 @@ class NET_EXPORT HostResolverImpl
HostCache::EntryStaleness* stale_info,
const BoundNetLog& source_net_log);
+ void InitializePersistence(
+ const PersistCallback& persist_callback,
+ std::unique_ptr<const base::Value> old_data) override;
+
void set_proc_params_for_test(const ProcTaskParams& proc_params) {
proc_params_ = proc_params;
}
@@ -297,6 +302,12 @@ class NET_EXPORT HostResolverImpl
// and resulted in |net_error|.
void OnDnsTaskResolve(int net_error);
+ void SchedulePersist();
+ void DoPersist();
+
+ void ApplyPersistentData(std::unique_ptr<const base::Value>);
+ std::unique_ptr<const base::Value> GetPersistentData();
+
// Allows the tests to catch slots leaking out of the dispatcher. One
// HostResolverImpl::Job could occupy multiple PrioritizedDispatcher job
// slots.
@@ -353,6 +364,10 @@ class NET_EXPORT HostResolverImpl
// tasks, but can be overridden for tests.
scoped_refptr<base::TaskRunner> worker_task_runner_;
+ bool persist_initialized_;
+ PersistCallback persist_callback_;
+ base::OneShotTimer persist_timer_;
+
base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_;
base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698