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

Unified Diff: net/tools/quic/test_tools/server_thread.h

Issue 132073002: Fix end_to_end_test performance regression caused by using mutexes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/test_tools/server_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/server_thread.h
diff --git a/net/tools/quic/test_tools/server_thread.h b/net/tools/quic/test_tools/server_thread.h
index 520fffb4427aaf1bc9a6e68a6e7d5b1a2bc3b844..c2c4c61cf423acbe23ed53ad07a161737ae1ae90 100644
--- a/net/tools/quic/test_tools/server_thread.h
+++ b/net/tools/quic/test_tools/server_thread.h
@@ -24,19 +24,22 @@ class ServerThread : public base::SimpleThread {
virtual ~ServerThread();
- // SimpleThread implementation.
- virtual void Run() OVERRIDE;
+ // Prepares the server, but does not start accepting connections. Useful for
+ // injecting mocks.
+ void Initialize();
- // Waits until the server has started and is listening for requests.
- void WaitForServerStartup();
+ // Runs the event loop. Will initialize if necessary.
+ virtual void Run() OVERRIDE;
// Waits for the handshake to be confirmed for the first session created.
void WaitForCryptoHandshakeConfirmed();
- // Pauses execution of the server until Resume() is called.
+ // Pauses execution of the server until Resume() is called. May only be
+ // called once.
void Pause();
- // Resumes execution of the server after Pause() has been called.
+ // Resumes execution of the server after Pause() has been called. May only
+ // be called once.
void Resume();
// Stops the server from executing and shuts it down, destroying all
@@ -54,10 +57,11 @@ class ServerThread : public base::SimpleThread {
private:
void MaybeNotifyOfHandshakeConfirmation();
- base::Lock event_loop_mu_; // Held when the server is processing events.
- base::WaitableEvent listening_; // Notified when the server is listening.
base::WaitableEvent confirmed_; // Notified when the first handshake is
// confirmed.
+ base::WaitableEvent pause_; // Notified when the server should pause.
+ base::WaitableEvent paused_; // Notitied when the server has paused
+ base::WaitableEvent resume_; // Notified when the server should resume.
base::WaitableEvent quit_; // Notified when the server should quit.
tools::QuicServer server_;
@@ -65,6 +69,8 @@ class ServerThread : public base::SimpleThread {
base::Lock port_lock_;
int port_;
+ bool initialized_;
+
DISALLOW_COPY_AND_ASSIGN(ServerThread);
};
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/test_tools/server_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698