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

Unified Diff: components/cronet/android/test/quic_test_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 | « no previous file | components/grpc_support/test/quic_test_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/test/quic_test_server.cc
diff --git a/components/cronet/android/test/quic_test_server.cc b/components/cronet/android/test/quic_test_server.cc
index 88819d632a4cbd55d5339bdde491771b3dc0b92b..e704253a9ddd094e04d1c954d3c58c9095389da0 100644
--- a/components/cronet/android/test/quic_test_server.cc
+++ b/components/cronet/android/test/quic_test_server.cc
@@ -31,6 +31,7 @@ namespace {
static const int kServerPort = 6121;
base::Thread* g_quic_server_thread = nullptr;
+net::QuicInMemoryCache* g_quic_in_memory_cache = nullptr;
net::QuicSimpleServer* g_quic_server = nullptr;
void StartOnServerThread(const base::FilePath& test_files_root,
@@ -41,8 +42,8 @@ void StartOnServerThread(const base::FilePath& test_files_root,
// Set up in-memory cache.
base::FilePath file_dir = test_files_root.Append("quic_data");
CHECK(base::PathExists(file_dir)) << "Quic data does not exist";
- net::QuicInMemoryCache::GetInstance()->InitializeFromDirectory(
- file_dir.value());
+ g_quic_in_memory_cache = new net::QuicInMemoryCache();
+ g_quic_in_memory_cache->InitializeFromDirectory(file_dir.value());
net::QuicConfig config;
// Set up server certs.
@@ -53,10 +54,10 @@ void StartOnServerThread(const base::FilePath& test_files_root,
directory.Append("quic_test.example.com.crt"),
directory.Append("quic_test.example.com.key.pkcs8"),
directory.Append("quic_test.example.com.key.sct")));
- g_quic_server =
- new net::QuicSimpleServer(std::move(proof_source), config,
- net::QuicCryptoServerConfig::ConfigOptions(),
- net::AllSupportedVersions());
+ g_quic_server = new net::QuicSimpleServer(
+ std::move(proof_source), config,
+ net::QuicCryptoServerConfig::ConfigOptions(), net::AllSupportedVersions(),
+ g_quic_in_memory_cache);
// Start listening.
int rv = g_quic_server->Listen(
@@ -70,6 +71,7 @@ void ShutdownOnServerThread() {
DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread());
g_quic_server->Shutdown();
delete g_quic_server;
+ delete g_quic_in_memory_cache;
}
} // namespace
« no previous file with comments | « no previous file | components/grpc_support/test/quic_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698