| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_TOOLS_QUIC_SERVER_THREAD_H_ | 5 #ifndef NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| 6 #define NET_TOOLS_QUIC_SERVER_THREAD_H_ | 6 #define NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/threading/simple_thread.h" | 8 #include "base/threading/simple_thread.h" |
| 9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
| 10 #include "net/quic/quic_config.h" | 10 #include "net/quic/quic_config.h" |
| 11 #include "net/tools/quic/quic_server.h" | 11 #include "net/tools/quic/quic_server.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 namespace tools { | 14 namespace tools { |
| 15 namespace test { | 15 namespace test { |
| 16 | 16 |
| 17 // Simple wrapper class to run server in a thread. | 17 // Simple wrapper class to run server in a thread. |
| 18 class ServerThread : public base::SimpleThread { | 18 class ServerThread : public base::SimpleThread { |
| 19 public: | 19 public: |
| 20 ServerThread(IPEndPoint address, | 20 ServerThread(IPEndPoint address, |
| 21 const QuicConfig& config, | 21 const QuicConfig& config, |
| 22 const QuicVersionVector& supported_versions, |
| 22 bool strike_register_no_startup_period); | 23 bool strike_register_no_startup_period); |
| 23 | 24 |
| 24 virtual ~ServerThread(); | 25 virtual ~ServerThread(); |
| 25 | 26 |
| 26 virtual void Run() OVERRIDE; | 27 virtual void Run() OVERRIDE; |
| 27 | 28 |
| 28 int GetPort(); | 29 int GetPort(); |
| 29 | 30 |
| 30 base::WaitableEvent* listening() { return &listening_; } | 31 base::WaitableEvent* listening() { return &listening_; } |
| 31 base::WaitableEvent* quit() { return &quit_; } | 32 base::WaitableEvent* quit() { return &quit_; } |
| 32 QuicServer* server() { return &server_; } | 33 QuicServer* server() { return &server_; } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 base::WaitableEvent listening_; | 36 base::WaitableEvent listening_; |
| 36 base::WaitableEvent quit_; | 37 base::WaitableEvent quit_; |
| 37 base::Lock port_lock_; | 38 base::Lock port_lock_; |
| 38 tools::QuicServer server_; | 39 tools::QuicServer server_; |
| 39 IPEndPoint address_; | 40 IPEndPoint address_; |
| 40 int port_; | 41 int port_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(ServerThread); | 43 DISALLOW_COPY_AND_ASSIGN(ServerThread); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace test | 46 } // namespace test |
| 46 } // namespace tools | 47 } // namespace tools |
| 47 } // namespace net | 48 } // namespace net |
| 48 | 49 |
| 49 #endif // NET_TOOLS_QUIC_SERVER_THREAD_H_ | 50 #endif // NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| OLD | NEW |