Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Unified Diff: webrtc/test/channel_transport/udp_socket2_win.cc

Issue 1606993002: Remove use of ConditionVariableWrapper and CriticalSectionWrapper from UdpSocket2Windows. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove unnecessary variable Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/test/channel_transport/udp_socket2_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/channel_transport/udp_socket2_win.cc
diff --git a/webrtc/test/channel_transport/udp_socket2_win.cc b/webrtc/test/channel_transport/udp_socket2_win.cc
index adeb46a9d2d064daae7515a590ac8564cf1e6587..2858c2d002d0795237fa04ffb67aa04daa4c1cd5 100644
--- a/webrtc/test/channel_transport/udp_socket2_win.cc
+++ b/webrtc/test/channel_transport/udp_socket2_win.cc
@@ -50,7 +50,7 @@ UdpSocket2Windows::UdpSocket2Windows(const int32_t id,
_outstandingCallComplete(0),
_terminate(false),
_addedToMgr(false),
- _safeTodelete(false),
+ delete_event_(true, false),
_outstandingCallsDisabled(false),
_clientHandle(NULL),
_flowHandle(NULL),
@@ -69,12 +69,9 @@ UdpSocket2Windows::UdpSocket2Windows(const int32_t id,
_obj = NULL;
_incomingCb = NULL;
_socket = INVALID_SOCKET;
- _pCrit = CriticalSectionWrapper::CreateCriticalSection();
_ptrCbRWLock = RWLockWrapper::CreateRWLock();
_ptrDestRWLock = RWLockWrapper::CreateRWLock();
_ptrSocketRWLock = RWLockWrapper::CreateRWLock();
- _ptrDeleteCrit = CriticalSectionWrapper::CreateCriticalSection();
- _ptrDeleteCond = ConditionVariableWrapper::CreateConditionVariable();
// Check if QoS is supported.
BOOL bProtocolFound = FALSE;
@@ -185,17 +182,13 @@ UdpSocket2Windows::~UdpSocket2Windows()
WEBRTC_TRACE(kTraceMemory, kTraceTransport, _id,
"UdpSocket2Windows::~UdpSocket2Windows()");
- WaitForOutstandingCalls();
+ delete_event_.Wait(rtc::Event::kForever);
+
delete _ptrCbRWLock;
- delete _ptrDeleteCrit;
- delete _ptrDeleteCond;
delete _ptrDestRWLock;
delete _ptrSocketRWLock;
- if(_pCrit)
- delete _pCrit;
-
if (_flow)
{
free(_flow);
@@ -667,7 +660,6 @@ void UdpSocket2Windows::CloseBlocking()
// Reclaims the socket and prevents it from being used again.
InvalidateSocket();
DisableNewOutstandingCalls();
- WaitForOutstandingCalls();
delete this;
}
@@ -1279,9 +1271,7 @@ void UdpSocket2Windows::OutstandingCallCompleted()
{
// Only one thread will enter here. The thread with the last outstanding
// call.
- CriticalSectionScoped cs(_ptrDeleteCrit);
- _safeTodelete = true;
- _ptrDeleteCond->Wake();
+ delete_event_.Set();
}
}
@@ -1302,18 +1292,7 @@ void UdpSocket2Windows::DisableNewOutstandingCalls()
if(noOutstandingCalls)
{
- CriticalSectionScoped cs(_ptrDeleteCrit);
- _safeTodelete = true;
- _ptrDeleteCond->Wake();
- }
-}
-
-void UdpSocket2Windows::WaitForOutstandingCalls()
-{
- CriticalSectionScoped cs(_ptrDeleteCrit);
- while(!_safeTodelete)
- {
- _ptrDeleteCond->SleepCS(*_ptrDeleteCrit);
+ delete_event_.Set();
}
}
« no previous file with comments | « webrtc/test/channel_transport/udp_socket2_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698