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

Unified Diff: net/tools/quic/quic_server.cc

Issue 2518063007: Pass QuicInMemoryCache directly instead of using a singleton. (Closed)
Patch Set: Fix Cronet compile error Created 4 years, 1 month 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/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_bin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_server.cc
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc
index 4aa982bd173a7c52718b60f1e14bd057dff90909..d29a999105a933f1b6752099e34c8c6b6a343115 100644
--- a/net/tools/quic/quic_server.cc
+++ b/net/tools/quic/quic_server.cc
@@ -49,17 +49,20 @@ const char kSourceAddressTokenSecret[] = "secret";
const size_t kNumSessionsToCreatePerSocketEvent = 16;
-QuicServer::QuicServer(std::unique_ptr<ProofSource> proof_source)
+QuicServer::QuicServer(std::unique_ptr<ProofSource> proof_source,
+ QuicInMemoryCache* in_memory_cache)
: QuicServer(std::move(proof_source),
QuicConfig(),
QuicCryptoServerConfig::ConfigOptions(),
- AllSupportedVersions()) {}
+ AllSupportedVersions(),
+ in_memory_cache) {}
QuicServer::QuicServer(
std::unique_ptr<ProofSource> proof_source,
const QuicConfig& config,
const QuicCryptoServerConfig::ConfigOptions& crypto_config_options,
- const QuicVersionVector& supported_versions)
+ const QuicVersionVector& supported_versions,
+ QuicInMemoryCache* in_memory_cache)
: port_(0),
fd_(-1),
packets_dropped_(0),
@@ -70,7 +73,8 @@ QuicServer::QuicServer(
std::move(proof_source)),
crypto_config_options_(crypto_config_options),
version_manager_(supported_versions),
- packet_reader_(new QuicPacketReader()) {
+ packet_reader_(new QuicPacketReader()),
+ in_memory_cache_(in_memory_cache) {
Initialize();
}
@@ -93,8 +97,7 @@ void QuicServer::Initialize() {
epoll_server_.set_timeout_in_us(50 * 1000);
if (!FLAGS_quic_in_memory_cache_dir.empty()) {
- QuicInMemoryCache::GetInstance()->InitializeFromDirectory(
- FLAGS_quic_in_memory_cache_dir);
+ in_memory_cache_->InitializeFromDirectory(FLAGS_quic_in_memory_cache_dir);
}
QuicEpollClock clock(&epoll_server_);
@@ -148,7 +151,8 @@ QuicDispatcher* QuicServer::CreateQuicDispatcher() {
std::unique_ptr<QuicCryptoServerStream::Helper>(
new QuicSimpleCryptoServerStreamHelper(QuicRandom::GetInstance())),
std::unique_ptr<QuicEpollAlarmFactory>(
- new QuicEpollAlarmFactory(&epoll_server_)));
+ new QuicEpollAlarmFactory(&epoll_server_)),
+ in_memory_cache_);
}
void QuicServer::WaitForEvents() {
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698