OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #ifndef WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_SOCKET2_MANAGER_WINDOWS_H_ | 11 #ifndef WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_SOCKET2_MANAGER_WINDOWS_H_ |
12 #define WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_SOCKET2_MANAGER_WINDOWS_H_ | 12 #define WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_SOCKET2_MANAGER_WINDOWS_H_ |
13 | 13 |
14 #include <winsock2.h> | 14 #include <winsock2.h> |
15 #include <list> | 15 #include <list> |
16 | 16 |
17 #include "webrtc/system_wrappers/interface/atomic32.h" | 17 #include "webrtc/base/atomicops.h" |
18 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 18 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
19 #include "webrtc/system_wrappers/interface/event_wrapper.h" | 19 #include "webrtc/system_wrappers/interface/event_wrapper.h" |
20 #include "webrtc/system_wrappers/interface/thread_wrapper.h" | 20 #include "webrtc/system_wrappers/interface/thread_wrapper.h" |
21 #include "webrtc/test/channel_transport/udp_socket2_win.h" | 21 #include "webrtc/test/channel_transport/udp_socket2_win.h" |
22 #include "webrtc/test/channel_transport/udp_socket_manager_wrapper.h" | 22 #include "webrtc/test/channel_transport/udp_socket_manager_wrapper.h" |
23 #include "webrtc/test/channel_transport/udp_transport.h" | 23 #include "webrtc/test/channel_transport/udp_transport.h" |
24 | 24 |
25 #define MAX_IO_BUFF_SIZE 1600 | 25 #define MAX_IO_BUFF_SIZE 1600 |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 class IoContextPool | 70 class IoContextPool |
71 { | 71 { |
72 public: | 72 public: |
73 IoContextPool(); | 73 IoContextPool(); |
74 virtual ~IoContextPool(); | 74 virtual ~IoContextPool(); |
75 virtual int32_t Init(uint32_t increaseSize = 128); | 75 virtual int32_t Init(uint32_t increaseSize = 128); |
76 // Re-use an old unused IO context or create a new one. | 76 // Re-use an old unused IO context or create a new one. |
77 virtual PerIoContext* PopIoContext(); | 77 virtual PerIoContext* PopIoContext(); |
78 virtual int32_t PushIoContext(PerIoContext* pIoContext); | 78 virtual int32_t PushIoContext(PerIoContext* pIoContext); |
79 virtual inline int32_t GetSize(uint32_t* inUse = 0) | 79 virtual inline int32_t GetSize(uint32_t* inUse = 0) { |
80 {return _size.Value();} | 80 return rtc::AtomicOps::AcquireLoad(&_size); |
| 81 } |
81 virtual int32_t Free(); | 82 virtual int32_t Free(); |
82 private: | 83 private: |
83 // Sample code for use of msfts single linked atomic list can be found here: | 84 // Sample code for use of msfts single linked atomic list can be found here: |
84 // http://msdn.microsoft.com/en-us/library/ms686962(VS.85).aspx | 85 // http://msdn.microsoft.com/en-us/library/ms686962(VS.85).aspx |
85 | 86 |
86 // Atomic single linked list head. | 87 // Atomic single linked list head. |
87 PSLIST_HEADER _pListHead; | 88 PSLIST_HEADER _pListHead; |
88 | 89 |
89 bool _init; | 90 bool _init; |
90 Atomic32 _size; | 91 volatile int _size; |
91 Atomic32 _inUse; | 92 volatile int _inUse; |
92 }; | 93 }; |
93 | 94 |
94 class UdpSocket2WorkerWindows | 95 class UdpSocket2WorkerWindows |
95 { | 96 { |
96 public: | 97 public: |
97 UdpSocket2WorkerWindows(HANDLE ioCompletionHandle); | 98 UdpSocket2WorkerWindows(HANDLE ioCompletionHandle); |
98 virtual ~UdpSocket2WorkerWindows(); | 99 virtual ~UdpSocket2WorkerWindows(); |
99 | 100 |
100 virtual bool Start(); | 101 virtual bool Start(); |
101 virtual bool Stop(); | 102 virtual bool Stop(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 EventWrapper* _event; | 154 EventWrapper* _event; |
154 | 155 |
155 HANDLE _ioCompletionHandle; | 156 HANDLE _ioCompletionHandle; |
156 IoContextPool _ioContextPool; | 157 IoContextPool _ioContextPool; |
157 }; | 158 }; |
158 | 159 |
159 } // namespace test | 160 } // namespace test |
160 } // namespace webrtc | 161 } // namespace webrtc |
161 | 162 |
162 #endif // WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_SOCKET2_MANAGER_WINDOWS_H_ | 163 #endif // WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_SOCKET2_MANAGER_WINDOWS_H_ |
OLD | NEW |