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

Unified Diff: net/http/http_cache.cc

Issue 2821053004: Revert of Remove the code to store and load QUIC server configs in the disk cache. (Closed)
Patch Set: Created 3 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 | « net/http/disk_cache_based_quic_server_info_unittest.cc ('k') | net/http/http_network_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 968cffa9f587378ead01e2a406dcfeb2c025f5ed..93d39cc9a936f391ba6cc06ec9c20a92ac5bbe14 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -37,6 +37,7 @@
#include "net/base/net_errors.h"
#include "net/base/upload_data_stream.h"
#include "net/disk_cache/disk_cache.h"
+#include "net/http/disk_cache_based_quic_server_info.h"
#include "net/http/http_cache_lookup_manager.h"
#include "net/http/http_cache_transaction.h"
#include "net/http/http_network_layer.h"
@@ -302,6 +303,24 @@
}
//-----------------------------------------------------------------------------
+
+class HttpCache::QuicServerInfoFactoryAdaptor : public QuicServerInfoFactory {
+ public:
+ explicit QuicServerInfoFactoryAdaptor(HttpCache* http_cache)
+ : http_cache_(http_cache) {
+ }
+
+ std::unique_ptr<QuicServerInfo> GetForServer(
+ const QuicServerId& server_id) override {
+ return base::MakeUnique<DiskCacheBasedQuicServerInfo>(server_id,
+ http_cache_);
+ }
+
+ private:
+ HttpCache* const http_cache_;
+};
+
+//-----------------------------------------------------------------------------
HttpCache::HttpCache(HttpNetworkSession* session,
std::unique_ptr<BackendFactory> backend_factory,
bool is_main_cache)
@@ -334,6 +353,12 @@
session->SetServerPushDelegate(
base::MakeUnique<HttpCacheLookupManager>(this));
+
+ if (!session->quic_stream_factory()->has_quic_server_info_factory()) {
+ // QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor.
+ session->quic_stream_factory()->set_quic_server_info_factory(
+ new QuicServerInfoFactoryAdaptor(this));
+ }
}
HttpCache::~HttpCache() {
« no previous file with comments | « net/http/disk_cache_based_quic_server_info_unittest.cc ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698