// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_CRONET_HOST_CACHE_PERSISTENCE_MANAGER_H_ #define COMPONENTS_CRONET_HOST_CACHE_PERSISTENCE_MANAGER_H_ #include <memory> #include <string> #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "components/prefs/pref_change_registrar.h" #include "net/dns/host_cache.h" #include "net/log/net_log_with_source.h" class PrefService; namespace net { class NetLog; } namespace cronet { // Handles the interaction between HostCache and prefs for persistence. // When notified of a change in the HostCache, starts a timer, or ignores if the // timer is already running. When that timer expires, writes the current state // of the HostCache to prefs. // // Can be used with synchronous or asynchronous prefs loading. Not appropriate // for use outside of Cronet because its network and prefs operations run on // the same sequence. Must be created after and destroyed before the HostCache // and PrefService. class HostCachePersistenceManager : public net::HostCache::PersistenceDelegate { … }; } // namespace cronet #endif // COMPONENTS_CRONET_HOST_CACHE_PERSISTENCE_MANAGER_H_