Use per-context HostCache
Per-context HostCaches are now used for all resolution cache lookups and
cache stores. The old manager-wide cache is gone along with the
manager-wide option to enable/disable caching.
The ContextHostResolver now also registers/deregisters the caches with
HostResolverManager on creation/destruction in order for them to receive
invalidation notifications.
Note that it appears all callers of HostCache browser data removal
already go through appropriate NetworkContexts rather than making
assumptions about the cache being global, so it all works out that such
cache clearings will clear the relevant per-context caches when
NetworkContext gets the cache to clear from its URLRequestContext and
ContextHostResolver.
Bug: 934402
Change-Id: Icc27f248b86f2140e1306f87008b23b5ff7ac6b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1560372
Commit-Queue: Eric Orth <[email protected]>
Reviewed-by: Asanka Herath <[email protected]>
Cr-Commit-Position: refs/heads/master@{#652908}
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index 4fa4779..5862539 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -9284,7 +9284,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -9381,7 +9381,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -9443,7 +9443,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -9511,7 +9511,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -9572,7 +9572,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
// Socket for the stale connection which will invoke connection closure.
MockQuicData quic_data;
@@ -9647,7 +9647,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -9721,7 +9721,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -9842,7 +9842,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
// Socket for the stale connection which is supposed to disconnect.
MockQuicData quic_data;
@@ -9897,7 +9897,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
// Simulate synchronous connect failure.
MockQuicData quic_data;
@@ -9945,7 +9945,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
// Add failure for the stale connection.
MockQuicData quic_data;
@@ -10009,7 +10009,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
// Add failure for stale connection.
MockQuicData quic_data;
@@ -10063,7 +10063,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
// Socket data for stale connection which is supposed to disconnect.
MockQuicData quic_data;
@@ -10117,7 +10117,7 @@
HostCache* cache = host_resolver_->GetHostCache();
cache->Set(key, entry, base::TimeTicks::Now(), zero);
// Expire the cache
- cache->OnNetworkChange();
+ cache->Invalidate();
MockQuicData quic_data;
quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);