| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_WINSOCK_UTIL_H_ | 5 #ifndef NET_BASE_WINSOCK_UTIL_H_ |
| 6 #define NET_BASE_WINSOCK_UTIL_H_ | 6 #define NET_BASE_WINSOCK_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <winsock2.h> | 9 #include <winsock2.h> |
| 10 | 10 |
| 11 #include "net/base/net_export.h" | |
| 12 | |
| 13 namespace net { | 11 namespace net { |
| 14 | 12 |
| 15 // Bluetooth address size. Windows Bluetooth is supported via winsock. | 13 // Bluetooth address size. Windows Bluetooth is supported via winsock. |
| 16 static const size_t kBluetoothAddressSize = 6; | 14 static const size_t kBluetoothAddressSize = 6; |
| 17 | 15 |
| 18 // Assert that the (manual-reset) event object is not signaled. | 16 // Assert that the (manual-reset) event object is not signaled. |
| 19 void AssertEventNotSignaled(WSAEVENT hEvent); | 17 void AssertEventNotSignaled(WSAEVENT hEvent); |
| 20 | 18 |
| 21 // If the (manual-reset) event object is signaled, resets it and returns true. | 19 // If the (manual-reset) event object is signaled, resets it and returns true. |
| 22 // Otherwise, does nothing and returns false. Called after a Winsock function | 20 // Otherwise, does nothing and returns false. Called after a Winsock function |
| 23 // succeeds synchronously | 21 // succeeds synchronously |
| 24 // | 22 // |
| 25 // Our testing shows that except in rare cases (when running inside QEMU), | 23 // Our testing shows that except in rare cases (when running inside QEMU), |
| 26 // the event object is already signaled at this point, so we call this method | 24 // the event object is already signaled at this point, so we call this method |
| 27 // to avoid a context switch in common cases. This is just a performance | 25 // to avoid a context switch in common cases. This is just a performance |
| 28 // optimization. The code still works if this function simply returns false. | 26 // optimization. The code still works if this function simply returns false. |
| 29 bool ResetEventIfSignaled(WSAEVENT hEvent); | 27 bool ResetEventIfSignaled(WSAEVENT hEvent); |
| 30 | 28 |
| 31 } // namespace net | 29 } // namespace net |
| 32 | 30 |
| 33 #endif // NET_BASE_WINSOCK_UTIL_H_ | 31 #endif // NET_BASE_WINSOCK_UTIL_H_ |
| OLD | NEW |