| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_SOCKET_TCP_PINGER_H_ | 5 #ifndef NET_SOCKET_TCP_PINGER_H_ |
| 6 #define NET_SOCKET_TCP_PINGER_H_ | 6 #define NET_SOCKET_TCP_PINGER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 event_.TimedWait(tryTimeout); | 108 event_.TimedWait(tryTimeout); |
| 109 return net_error_; | 109 return net_error_; |
| 110 } | 110 } |
| 111 | 111 |
| 112 int WaitForResult() { | 112 int WaitForResult() { |
| 113 event_.Wait(); | 113 event_.Wait(); |
| 114 return net_error_; | 114 return net_error_; |
| 115 } | 115 } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 friend class base::RefCountedThreadSafe<Worker>; |
| 119 |
| 120 ~Worker() {} |
| 121 |
| 118 base::WaitableEvent event_; | 122 base::WaitableEvent event_; |
| 119 int net_error_; | 123 int net_error_; |
| 120 net::AddressList addr_; | 124 net::AddressList addr_; |
| 121 scoped_ptr<TCPClientSocket> sock_; | 125 scoped_ptr<TCPClientSocket> sock_; |
| 122 net::CompletionCallbackImpl<Worker> connect_callback_; | 126 net::CompletionCallbackImpl<Worker> connect_callback_; |
| 123 }; | 127 }; |
| 124 | 128 |
| 125 base::Thread io_thread_; | 129 base::Thread io_thread_; |
| 126 Worker* worker_; | 130 Worker* worker_; |
| 127 DISALLOW_COPY_AND_ASSIGN(TCPPinger); | 131 DISALLOW_COPY_AND_ASSIGN(TCPPinger); |
| 128 }; | 132 }; |
| 129 | 133 |
| 130 } // namespace net | 134 } // namespace net |
| 131 | 135 |
| 132 #endif // NET_SOCKET_TCP_PINGER_H_ | 136 #endif // NET_SOCKET_TCP_PINGER_H_ |
| OLD | NEW |