| Index: webrtc/voice_engine/test/channel_transport/udp_socket2_manager_win.cc | 
| diff --git a/webrtc/voice_engine/test/channel_transport/udp_socket2_manager_win.cc b/webrtc/voice_engine/test/channel_transport/udp_socket2_manager_win.cc | 
| index bb268539f3ad642a8c3801e3acd8ddd63765baec..88123f96f11bf1585f39633108523a5e0bd6e8f2 100644 | 
| --- a/webrtc/voice_engine/test/channel_transport/udp_socket2_manager_win.cc | 
| +++ b/webrtc/voice_engine/test/channel_transport/udp_socket2_manager_win.cc | 
| @@ -28,21 +28,19 @@ UdpSocket2ManagerWindows::UdpSocket2ManagerWindows() | 
| _stopped(false), | 
| _init(false), | 
| _pCrit(CriticalSectionWrapper::CreateCriticalSection()), | 
| -      _ioCompletionHandle(NULL), | 
| +      _ioCompletionHandle(nullptr), | 
| _numActiveSockets(0), | 
| -      _event(EventWrapper::Create()) | 
| -{ | 
| -    _managerNumber = _numOfActiveManagers++; | 
| - | 
| -    if(_numOfActiveManagers == 1) | 
| -    { | 
| -        WORD wVersionRequested = MAKEWORD(2, 2); | 
| -        WSADATA wsaData; | 
| -        _wsaInit = WSAStartup(wVersionRequested, &wsaData) == 0; | 
| -        // TODO (hellner): seems safer to use RAII for this. E.g. what happens | 
| -        //                 if a UdpSocket2ManagerWindows() created and destroyed | 
| -        //                 without being initialized. | 
| -    } | 
| +      _event(EventWrapper::Create()) { | 
| +  _managerNumber = _numOfActiveManagers++; | 
| + | 
| +  if (_numOfActiveManagers == 1) { | 
| +    WORD wVersionRequested = MAKEWORD(2, 2); | 
| +    WSADATA wsaData; | 
| +    _wsaInit = WSAStartup(wVersionRequested, &wsaData) == 0; | 
| +    // TODO (hellner): seems safer to use RAII for this. E.g. what happens | 
| +    //                 if a UdpSocket2ManagerWindows() created and destroyed | 
| +    //                 without being initialized. | 
| +  } | 
| } | 
|  | 
| UdpSocket2ManagerWindows::~UdpSocket2ManagerWindows() | 
| @@ -152,20 +150,16 @@ bool UdpSocket2ManagerWindows::StartWorkerThreads() | 
| { | 
| _pCrit->Enter(); | 
|  | 
| -        _ioCompletionHandle = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, | 
| -                                                     0, 0); | 
| -        if(_ioCompletionHandle == NULL) | 
| -        { | 
| -            int32_t error = GetLastError(); | 
| -            WEBRTC_TRACE( | 
| -                kTraceError, | 
| -                kTraceTransport, | 
| -                _id, | 
| -                "UdpSocket2ManagerWindows(%d)::StartWorkerThreads()" | 
| -                "_ioCompletioHandle == NULL: error:%d", | 
| -                _managerNumber,error); | 
| -            _pCrit->Leave(); | 
| -            return false; | 
| +        _ioCompletionHandle = | 
| +            CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 0); | 
| +        if (_ioCompletionHandle == nullptr) { | 
| +          int32_t error = GetLastError(); | 
| +          WEBRTC_TRACE(kTraceError, kTraceTransport, _id, | 
| +                       "UdpSocket2ManagerWindows(%d)::StartWorkerThreads()" | 
| +                       "_ioCompletioHandle == null: error:%d", | 
| +                       _managerNumber, error); | 
| +          _pCrit->Leave(); | 
| +          return false; | 
| } | 
|  | 
| // Create worker threads. | 
| @@ -274,7 +268,7 @@ bool UdpSocket2ManagerWindows::StopWorkerThreads() | 
| uint32_t i = 0; | 
| for(i = 0; i < _workerThreadsList.size(); i++) | 
| { | 
| -            PostQueuedCompletionStatus(_ioCompletionHandle, 0 ,0 , NULL); | 
| +          PostQueuedCompletionStatus(_ioCompletionHandle, 0, 0, nullptr); | 
| } | 
| } | 
| for (WorkerList::iterator iter = _workerThreadsList.begin(); | 
| @@ -317,47 +311,35 @@ bool UdpSocket2ManagerWindows::AddSocketPrv(UdpSocket2Windows* s) | 
| return false; | 
| } | 
| _pCrit->Enter(); | 
| -    if(s == NULL) | 
| -    { | 
| -        WEBRTC_TRACE( | 
| -            kTraceError, | 
| -            kTraceTransport, | 
| -            _id, | 
| -            "UdpSocket2ManagerWindows(%d)::AddSocketPrv() socket == NULL", | 
| -            _managerNumber); | 
| -        _pCrit->Leave(); | 
| -        return false; | 
| +    if (s == nullptr) { | 
| +      WEBRTC_TRACE( | 
| +          kTraceError, kTraceTransport, _id, | 
| +          "UdpSocket2ManagerWindows(%d)::AddSocketPrv() socket == null", | 
| +          _managerNumber); | 
| +      _pCrit->Leave(); | 
| +      return false; | 
| } | 
| -    if(s->GetFd() == NULL || s->GetFd() == INVALID_SOCKET) | 
| -    { | 
| -        WEBRTC_TRACE( | 
| -            kTraceError, | 
| -            kTraceTransport, | 
| -            _id, | 
| -            "UdpSocket2ManagerWindows(%d)::AddSocketPrv() socket->GetFd() ==\ | 
| +    if (s->GetFd() == nullptr || s->GetFd() == INVALID_SOCKET) { | 
| +      WEBRTC_TRACE( | 
| +          kTraceError, kTraceTransport, _id, | 
| +          "UdpSocket2ManagerWindows(%d)::AddSocketPrv() socket->GetFd() ==\ | 
| %d", | 
| -            _managerNumber, | 
| -            (int32_t)s->GetFd()); | 
| -        _pCrit->Leave(); | 
| -        return false; | 
| - | 
| +          _managerNumber, (int32_t)s->GetFd()); | 
| +      _pCrit->Leave(); | 
| +      return false; | 
| } | 
| _ioCompletionHandle = CreateIoCompletionPort((HANDLE)s->GetFd(), | 
| _ioCompletionHandle, | 
| (ULONG_PTR)(s), 0); | 
| -    if(_ioCompletionHandle == NULL) | 
| -    { | 
| -        int32_t error = GetLastError(); | 
| -        WEBRTC_TRACE( | 
| -            kTraceError, | 
| -            kTraceTransport, | 
| -            _id, | 
| -            "UdpSocket2ManagerWindows(%d)::AddSocketPrv() Error adding to IO\ | 
| +    if (_ioCompletionHandle == nullptr) { | 
| +      int32_t error = GetLastError(); | 
| +      WEBRTC_TRACE( | 
| +          kTraceError, kTraceTransport, _id, | 
| +          "UdpSocket2ManagerWindows(%d)::AddSocketPrv() Error adding to IO\ | 
| completion: %d", | 
| -            _managerNumber, | 
| -            error); | 
| -        _pCrit->Leave(); | 
| -        return false; | 
| +          _managerNumber, error); | 
| +      _pCrit->Leave(); | 
| +      return false; | 
| } | 
| _numActiveSockets++; | 
| _pCrit->Leave(); | 
| @@ -383,10 +365,10 @@ PerIoContext* UdpSocket2ManagerWindows::PopIoContext() | 
| { | 
| if(!_init) | 
| { | 
| -        return NULL; | 
| +      return nullptr; | 
| } | 
|  | 
| -    PerIoContext* pIoC = NULL; | 
| +    PerIoContext* pIoC = nullptr; | 
| if(!_stopped) | 
| { | 
| pIoC = _ioContextPool.PopIoContext(); | 
| @@ -408,12 +390,7 @@ int32_t UdpSocket2ManagerWindows::PushIoContext(PerIoContext* pIoContext) | 
| } | 
|  | 
| IoContextPool::IoContextPool() | 
| -    : _pListHead(NULL), | 
| -      _init(false), | 
| -      _size(0), | 
| -      _inUse(0) | 
| -{ | 
| -} | 
| +    : _pListHead(nullptr), _init(false), _size(0), _inUse(0) {} | 
|  | 
| IoContextPool::~IoContextPool() | 
| { | 
| @@ -431,9 +408,8 @@ int32_t IoContextPool::Init(uint32_t /*increaseSize*/) | 
|  | 
| _pListHead = (PSLIST_HEADER)AlignedMalloc(sizeof(SLIST_HEADER), | 
| MEMORY_ALLOCATION_ALIGNMENT); | 
| -    if(_pListHead == NULL) | 
| -    { | 
| -        return -1; | 
| +    if (_pListHead == nullptr) { | 
| +      return -1; | 
| } | 
| InitializeSListHead(_pListHead); | 
| _init = true; | 
| @@ -444,24 +420,20 @@ PerIoContext* IoContextPool::PopIoContext() | 
| { | 
| if(!_init) | 
| { | 
| -        return NULL; | 
| +      return nullptr; | 
| } | 
|  | 
| PSLIST_ENTRY pListEntry = InterlockedPopEntrySList(_pListHead); | 
| -    if(pListEntry == NULL) | 
| -    { | 
| -        IoContextPoolItem* item = (IoContextPoolItem*) | 
| -            AlignedMalloc( | 
| -                sizeof(IoContextPoolItem), | 
| -                MEMORY_ALLOCATION_ALIGNMENT); | 
| -        if(item == NULL) | 
| -        { | 
| -            return NULL; | 
| -        } | 
| -        memset(&item->payload.ioContext,0,sizeof(PerIoContext)); | 
| -        item->payload.base = item; | 
| -        pListEntry = &(item->itemEntry); | 
| -        ++_size; | 
| +    if (pListEntry == nullptr) { | 
| +      IoContextPoolItem* item = (IoContextPoolItem*)AlignedMalloc( | 
| +          sizeof(IoContextPoolItem), MEMORY_ALLOCATION_ALIGNMENT); | 
| +      if (item == nullptr) { | 
| +        return nullptr; | 
| +      } | 
| +      memset(&item->payload.ioContext, 0, sizeof(PerIoContext)); | 
| +      item->payload.base = item; | 
| +      pListEntry = &(item->itemEntry); | 
| +      ++_size; | 
| } | 
| ++_inUse; | 
| return &((IoContextPoolItem*)pListEntry)->payload.ioContext; | 
| @@ -505,13 +477,12 @@ int32_t IoContextPool::Free() | 
|  | 
| int32_t itemsFreed = 0; | 
| PSLIST_ENTRY pListEntry = InterlockedPopEntrySList(_pListHead); | 
| -    while(pListEntry != NULL) | 
| -    { | 
| -        IoContextPoolItem* item = ((IoContextPoolItem*)pListEntry); | 
| -        AlignedFree(item); | 
| -        --_size; | 
| -        itemsFreed++; | 
| -        pListEntry = InterlockedPopEntrySList(_pListHead); | 
| +    while (pListEntry != nullptr) { | 
| +      IoContextPoolItem* item = ((IoContextPoolItem*)pListEntry); | 
| +      AlignedFree(item); | 
| +      --_size; | 
| +      itemsFreed++; | 
| +      pListEntry = InterlockedPopEntrySList(_pListHead); | 
| } | 
| return itemsFreed; | 
| } | 
| @@ -570,7 +541,7 @@ bool UdpSocket2WorkerWindows::Process() | 
| { | 
| int32_t success = 0; | 
| DWORD ioSize = 0; | 
| -    UdpSocket2Windows* pSocket = NULL; | 
| +    UdpSocket2Windows* pSocket = nullptr; | 
| PerIoContext* pIOContext = 0; | 
| OVERLAPPED* pOverlapped = 0; | 
| success = GetQueuedCompletionStatus(_ioCompletionHandle, | 
| @@ -589,15 +560,12 @@ bool UdpSocket2WorkerWindows::Process() | 
| // The IO context still needs to be reclaimed or re-used which is done | 
| // in UdpSocket2Windows::IOCompleted(..). | 
| } | 
| -    if(pSocket == NULL) | 
| -    { | 
| -        WEBRTC_TRACE( | 
| -            kTraceDebug, | 
| -            kTraceTransport, | 
| -            -1, | 
| -            "UdpSocket2WorkerWindows(%d)::Process(), pSocket == 0, end thread", | 
| -            _workerNumber); | 
| -        return true; | 
| +    if (pSocket == nullptr) { | 
| +      WEBRTC_TRACE( | 
| +          kTraceDebug, kTraceTransport, -1, | 
| +          "UdpSocket2WorkerWindows(%d)::Process(), pSocket == 0, end thread", | 
| +          _workerNumber); | 
| +      return true; | 
| } | 
| pIOContext = (PerIoContext*)pOverlapped; | 
| pSocket->IOCompleted(pIOContext,ioSize,error); | 
|  |