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

Unified Diff: net/tools/quic/test_tools/quic_test_server.cc

Issue 1457233003: Deprecate FLAGS_quic_count_unfinished_as_open_streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_client_session_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/quic_test_server.cc
diff --git a/net/tools/quic/test_tools/quic_test_server.cc b/net/tools/quic/test_tools/quic_test_server.cc
index baf33af15d7a5d3254581db773cadf06629ae9a6..2008ef4cfd4bad13fb9414810674a4c25c831aca 100644
--- a/net/tools/quic/test_tools/quic_test_server.cc
+++ b/net/tools/quic/test_tools/quic_test_server.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/run_loop.h"
+#include "base/synchronization/lock.h"
#include "base/thread_task_runner_handle.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
@@ -76,6 +77,7 @@ class QuicTestDispatcher : public QuicDispatcher {
QuicServerSession* CreateQuicSession(QuicConnectionId id,
const IPEndPoint& client) override {
+ base::AutoLock lock(factory_lock_);
if (session_factory_ == nullptr && stream_factory_ == nullptr &&
crypto_stream_factory_ == nullptr) {
return QuicDispatcher::CreateQuicSession(id, client);
@@ -97,30 +99,30 @@ class QuicTestDispatcher : public QuicDispatcher {
return session;
}
- void set_session_factory(QuicTestServer::SessionFactory* factory) {
+ void SetSessionFactory(QuicTestServer::SessionFactory* factory) {
+ base::AutoLock lock(factory_lock_);
DCHECK(session_factory_ == nullptr);
DCHECK(stream_factory_ == nullptr);
DCHECK(crypto_stream_factory_ == nullptr);
session_factory_ = factory;
}
- void set_stream_factory(QuicTestServer::StreamFactory* factory) {
+ void SetStreamFactory(QuicTestServer::StreamFactory* factory) {
+ base::AutoLock lock(factory_lock_);
DCHECK(session_factory_ == nullptr);
DCHECK(stream_factory_ == nullptr);
stream_factory_ = factory;
}
- void set_crypto_stream_factory(QuicTestServer::CryptoStreamFactory* factory) {
+ void SetCryptoStreamFactory(QuicTestServer::CryptoStreamFactory* factory) {
+ base::AutoLock lock(factory_lock_);
DCHECK(session_factory_ == nullptr);
DCHECK(crypto_stream_factory_ == nullptr);
crypto_stream_factory_ = factory;
}
- QuicTestServer::SessionFactory* session_factory() { return session_factory_; }
-
- QuicTestServer::StreamFactory* stream_factory() { return stream_factory_; }
-
private:
+ base::Lock factory_lock_;
QuicTestServer::SessionFactory* session_factory_; // Not owned.
QuicTestServer::StreamFactory* stream_factory_; // Not owned.
QuicTestServer::CryptoStreamFactory* crypto_stream_factory_; // Not owned.
@@ -143,16 +145,16 @@ QuicDispatcher* QuicTestServer::CreateQuicDispatcher() {
void QuicTestServer::SetSessionFactory(SessionFactory* factory) {
DCHECK(dispatcher());
- static_cast<QuicTestDispatcher*>(dispatcher())->set_session_factory(factory);
+ static_cast<QuicTestDispatcher*>(dispatcher())->SetSessionFactory(factory);
}
void QuicTestServer::SetSpdyStreamFactory(StreamFactory* factory) {
- static_cast<QuicTestDispatcher*>(dispatcher())->set_stream_factory(factory);
+ static_cast<QuicTestDispatcher*>(dispatcher())->SetStreamFactory(factory);
}
void QuicTestServer::SetCryptoStreamFactory(CryptoStreamFactory* factory) {
- static_cast<QuicTestDispatcher*>(dispatcher())
- ->set_crypto_stream_factory(factory);
+ static_cast<QuicTestDispatcher*>(dispatcher())->SetCryptoStreamFactory(
+ factory);
}
/////////////////////////// TEST SESSIONS ///////////////////////////////
« no previous file with comments | « net/tools/quic/quic_client_session_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698