| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 struct DnsLookup; | 86 struct DnsLookup; |
| 87 DnsLookup * dns_; | 87 DnsLookup * dns_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 /////////////////////////////////////////////////////////////////////////////// | 90 /////////////////////////////////////////////////////////////////////////////// |
| 91 // Win32SocketServer | 91 // Win32SocketServer |
| 92 /////////////////////////////////////////////////////////////////////////////// | 92 /////////////////////////////////////////////////////////////////////////////// |
| 93 | 93 |
| 94 class Win32SocketServer : public SocketServer { | 94 class Win32SocketServer : public SocketServer { |
| 95 public: | 95 public: |
| 96 explicit Win32SocketServer(MessageQueue* message_queue); | 96 Win32SocketServer(); |
| 97 virtual ~Win32SocketServer(); | 97 virtual ~Win32SocketServer(); |
| 98 | 98 |
| 99 void set_modeless_dialog(HWND hdlg) { | 99 void set_modeless_dialog(HWND hdlg) { |
| 100 hdlg_ = hdlg; | 100 hdlg_ = hdlg; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // SocketServer Interface | 103 // SocketServer Interface |
| 104 virtual Socket* CreateSocket(int type); | 104 virtual Socket* CreateSocket(int type); |
| 105 virtual Socket* CreateSocket(int family, int type); | 105 virtual Socket* CreateSocket(int family, int type); |
| 106 | 106 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 131 bool posted_; | 131 bool posted_; |
| 132 HWND hdlg_; | 132 HWND hdlg_; |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 /////////////////////////////////////////////////////////////////////////////// | 135 /////////////////////////////////////////////////////////////////////////////// |
| 136 // Win32Thread. Automatically pumps Windows messages. | 136 // Win32Thread. Automatically pumps Windows messages. |
| 137 /////////////////////////////////////////////////////////////////////////////// | 137 /////////////////////////////////////////////////////////////////////////////// |
| 138 | 138 |
| 139 class Win32Thread : public Thread { | 139 class Win32Thread : public Thread { |
| 140 public: | 140 public: |
| 141 Win32Thread() : ss_(this), id_(0) { | 141 explicit Win32Thread(SocketServer* ss) : Thread(ss), id_(0) {} |
| 142 set_socketserver(&ss_); | |
| 143 } | |
| 144 virtual ~Win32Thread() { | 142 virtual ~Win32Thread() { |
| 145 Stop(); | 143 Stop(); |
| 146 set_socketserver(nullptr); | |
| 147 } | 144 } |
| 148 virtual void Run() { | 145 virtual void Run() { |
| 149 id_ = GetCurrentThreadId(); | 146 id_ = GetCurrentThreadId(); |
| 150 Thread::Run(); | 147 Thread::Run(); |
| 151 id_ = 0; | 148 id_ = 0; |
| 152 } | 149 } |
| 153 virtual void Quit() { | 150 virtual void Quit() { |
| 154 PostThreadMessage(id_, WM_QUIT, 0, 0); | 151 PostThreadMessage(id_, WM_QUIT, 0, 0); |
| 155 } | 152 } |
| 156 private: | 153 private: |
| 157 Win32SocketServer ss_; | |
| 158 DWORD id_; | 154 DWORD id_; |
| 159 }; | 155 }; |
| 160 | 156 |
| 161 /////////////////////////////////////////////////////////////////////////////// | 157 /////////////////////////////////////////////////////////////////////////////// |
| 162 | 158 |
| 163 } // namespace rtc | 159 } // namespace rtc |
| 164 | 160 |
| 165 #endif // WEBRTC_WIN | 161 #endif // WEBRTC_WIN |
| 166 | 162 |
| 167 #endif // WEBRTC_BASE_WIN32SOCKETSERVER_H_ | 163 #endif // WEBRTC_BASE_WIN32SOCKETSERVER_H_ |
| OLD | NEW |