| 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_TEST_TOOLS_SERVER_THREAD_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_SERVER_THREAD_H_ |
| 6 #define NET_TOOLS_QUIC_TEST_TOOLS_SERVER_THREAD_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_SERVER_THREAD_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/synchronization/lock.h" | |
| 12 #include "base/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
| 13 #include "net/quic/core/quic_config.h" | 12 #include "net/quic/core/quic_config.h" |
| 13 #include "net/quic/platform/api/quic_mutex.h" |
| 14 #include "net/quic/platform/api/quic_socket_address.h" | 14 #include "net/quic/platform/api/quic_socket_address.h" |
| 15 #include "net/tools/quic/quic_server.h" | 15 #include "net/tools/quic/quic_server.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 namespace test { | 18 namespace test { |
| 19 | 19 |
| 20 // Simple wrapper class to run QuicServer in a dedicated thread. | 20 // Simple wrapper class to run QuicServer in a dedicated thread. |
| 21 class ServerThread : public base::SimpleThread { | 21 class ServerThread : public base::SimpleThread { |
| 22 public: | 22 public: |
| 23 ServerThread(QuicServer* server, const QuicSocketAddress& address); | 23 ServerThread(QuicServer* server, const QuicSocketAddress& address); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 base::WaitableEvent resume_; // Notified when the server should resume. | 68 base::WaitableEvent resume_; // Notified when the server should resume. |
| 69 base::WaitableEvent quit_; // Notified when the server should quit. | 69 base::WaitableEvent quit_; // Notified when the server should quit. |
| 70 | 70 |
| 71 std::unique_ptr<QuicServer> server_; | 71 std::unique_ptr<QuicServer> server_; |
| 72 QuicSocketAddress address_; | 72 QuicSocketAddress address_; |
| 73 base::Lock port_lock_; | 73 base::Lock port_lock_; |
| 74 int port_; | 74 int port_; |
| 75 | 75 |
| 76 bool initialized_; | 76 bool initialized_; |
| 77 | 77 |
| 78 base::Lock scheduled_actions_lock_; | 78 QuicMutex scheduled_actions_lock_; |
| 79 std::deque<std::function<void()>> scheduled_actions_; | 79 std::deque<std::function<void()>> scheduled_actions_ |
| 80 GUARDED_BY(scheduled_actions_lock_); |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(ServerThread); | 82 DISALLOW_COPY_AND_ASSIGN(ServerThread); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace test | 85 } // namespace test |
| 85 } // namespace net | 86 } // namespace net |
| 86 | 87 |
| 87 #endif // NET_TOOLS_QUIC_TEST_TOOLS_SERVER_THREAD_H_ | 88 #endif // NET_TOOLS_QUIC_TEST_TOOLS_SERVER_THREAD_H_ |
| OLD | NEW |