Chromium Code Reviews| Index: net/test/embedded_test_server/embedded_test_server.cc |
| diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc |
| index 75b46e22166e6fb8aaaccddaf74e46dd863f3072..0fb73602534b3c5cdcc3562c41f7152b570c6c9d 100644 |
| --- a/net/test/embedded_test_server/embedded_test_server.cc |
| +++ b/net/test/embedded_test_server/embedded_test_server.cc |
| @@ -92,9 +92,28 @@ HttpListenSocket::HttpListenSocket(const SocketDescriptor socket_descriptor, |
| void HttpListenSocket::Listen() { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| +#if !defined(OS_POSIX) |
| + // This method may be called after the IO thread is changed, thus we need to |
| + // call |WatchSocket| again to make sure it listens on the current IO thread. |
| + // Only needed for non POSIX platforms, since on POSIX platforms |
| + // StreamListenSocket::Listen already calls WatchSocket inside the function. |
| + WatchSocket(WAITING_ACCEPT); |
| +#endif |
| TCPListenSocket::Listen(); |
| } |
| +void HttpListenSocket::ListenOnIOThread() { |
|
xiyuan
2014/08/12 18:35:54
This looks the same as HttpListenSocket::Listen. I
guohui
2014/08/12 19:01:16
Sorry this patch is broken =(
the #if block shoul
|
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| +#if !defined(OS_POSIX) |
| + // This method may be called after the IO thread is changed, thus we need to |
| + // call |WatchSocket| again to make sure it listens on the current IO thread. |
| + // Only needed for non POSIX platforms, since on POSIX platforms |
| + // StreamListenSocket::Listen already calls WatchSocket inside the function. |
| + WatchSocket(WAITING_ACCEPT); |
| +#endif |
| + Listen(); |
| +} |
| + |
| HttpListenSocket::~HttpListenSocket() { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| } |
| @@ -198,7 +217,7 @@ void EmbeddedTestServer::InitializeOnIOThread() { |
| void EmbeddedTestServer::ListenOnIOThread() { |
| DCHECK(io_thread_->message_loop_proxy()->BelongsToCurrentThread()); |
| DCHECK(Started()); |
| - listen_socket_->Listen(); |
| + listen_socket_->ListenOnIOThread(); |
| } |
| void EmbeddedTestServer::ShutdownOnIOThread() { |