mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 823056: Move locks to protect linked_ptr<> instances r=ehugg
This commit is contained in:
parent
8023ac8117
commit
f8ab8f1ffe
@ -474,11 +474,17 @@ bool CC_SIPCCService::isStarted()
|
||||
return bStarted;
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
CC_DevicePtr CC_SIPCCService::getActiveDevice()
|
||||
{
|
||||
return CC_SIPCCDevice::wrap(CCAPI_Device_getDeviceID());
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
vector<CC_DevicePtr> CC_SIPCCService::getDevices()
|
||||
{
|
||||
vector<CC_DevicePtr> devices;
|
||||
@ -492,6 +498,9 @@ vector<CC_DevicePtr> CC_SIPCCService::getDevices()
|
||||
return devices;
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
AudioControlPtr CC_SIPCCService::getAudioControl ()
|
||||
{
|
||||
if(audioControlWrapper != NULL)
|
||||
@ -505,6 +514,9 @@ AudioControlPtr CC_SIPCCService::getAudioControl ()
|
||||
}
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
VideoControlPtr CC_SIPCCService::getVideoControl ()
|
||||
{
|
||||
if(videoControlWrapper != NULL)
|
||||
@ -537,6 +549,9 @@ void CC_SIPCCService::applyLoggingMask (int newMask)
|
||||
}
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
void CC_SIPCCService::endAllActiveCalls()
|
||||
{
|
||||
CC_DevicePtr device = getActiveDevice();
|
||||
@ -588,6 +603,8 @@ void CC_SIPCCService::onDeviceEvent(ccapi_device_event_e type, cc_device_handle_
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::MutexAutoLock lock(_self->m_lock);
|
||||
|
||||
CC_SIPCCDevicePtr devicePtr = CC_SIPCCDevice::wrap(handle);
|
||||
if (devicePtr == NULL)
|
||||
{
|
||||
@ -616,6 +633,8 @@ void CC_SIPCCService::onFeatureEvent(ccapi_device_event_e type, cc_deviceinfo_re
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::MutexAutoLock lock(_self->m_lock);
|
||||
|
||||
cc_device_handle_t hDevice = CCAPI_Device_getDeviceID();
|
||||
CC_DevicePtr devicePtr = CC_SIPCCDevice::wrap(hDevice);
|
||||
if (devicePtr == NULL)
|
||||
@ -644,6 +663,8 @@ void CC_SIPCCService::onLineEvent(ccapi_line_event_e eventType, cc_lineid_t line
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::MutexAutoLock lock(_self->m_lock);
|
||||
|
||||
CC_LinePtr linePtr = CC_SIPCCLine::wrap(line);
|
||||
if (linePtr == NULL)
|
||||
{
|
||||
@ -671,6 +692,8 @@ void CC_SIPCCService::onCallEvent(ccapi_call_event_e eventType, cc_call_handle_t
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::MutexAutoLock lock(_self->m_lock);
|
||||
|
||||
CC_SIPCCCallPtr callPtr = CC_SIPCCCall::wrap(handle);
|
||||
if (callPtr == NULL)
|
||||
{
|
||||
@ -714,7 +737,7 @@ void CC_SIPCCService::removeCCObserver ( CC_Observer * observer )
|
||||
//Notify Observers
|
||||
void CC_SIPCCService::notifyDeviceEventObservers (ccapi_device_event_e eventType, CC_DevicePtr devicePtr, CC_DeviceInfoPtr info)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(m_lock);
|
||||
// m_lock must be held by the function that called us
|
||||
set<CC_Observer*>::const_iterator it = ccObservers.begin();
|
||||
for ( ; it != ccObservers.end(); it++ )
|
||||
{
|
||||
@ -724,7 +747,7 @@ void CC_SIPCCService::notifyDeviceEventObservers (ccapi_device_event_e eventType
|
||||
|
||||
void CC_SIPCCService::notifyFeatureEventObservers (ccapi_device_event_e eventType, CC_DevicePtr devicePtr, CC_FeatureInfoPtr info)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(m_lock);
|
||||
// m_lock must be held by the function that called us
|
||||
set<CC_Observer*>::const_iterator it = ccObservers.begin();
|
||||
for ( ; it != ccObservers.end(); it++ )
|
||||
{
|
||||
@ -734,7 +757,7 @@ void CC_SIPCCService::notifyFeatureEventObservers (ccapi_device_event_e eventTyp
|
||||
|
||||
void CC_SIPCCService::notifyLineEventObservers (ccapi_line_event_e eventType, CC_LinePtr linePtr, CC_LineInfoPtr info)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(m_lock);
|
||||
// m_lock must be held by the function that called us
|
||||
set<CC_Observer*>::const_iterator it = ccObservers.begin();
|
||||
for ( ; it != ccObservers.end(); it++ )
|
||||
{
|
||||
@ -744,7 +767,7 @@ void CC_SIPCCService::notifyLineEventObservers (ccapi_line_event_e eventType, CC
|
||||
|
||||
void CC_SIPCCService::notifyCallEventObservers (ccapi_call_event_e eventType, CC_CallPtr callPtr, CC_CallInfoPtr info)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(m_lock);
|
||||
// m_lock must be held by the function that called us
|
||||
set<CC_Observer*>::const_iterator it = ccObservers.begin();
|
||||
for ( ; it != ccObservers.end(); it++ )
|
||||
{
|
||||
@ -754,6 +777,10 @@ void CC_SIPCCService::notifyCallEventObservers (ccapi_call_event_e eventType, CC
|
||||
|
||||
// This is called when the SIP stack has caused a new stream to be allocated. This function will
|
||||
// find the call associated with that stream so that the call can store the streamId.
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
void CC_SIPCCService::registerStream(cc_call_handle_t call, int streamId, bool isVideo)
|
||||
{
|
||||
CSFLogDebugS( logTag, "registerStream for call: " << call << " strId=" << streamId << " video=" << isVideo);
|
||||
@ -769,6 +796,9 @@ void CC_SIPCCService::registerStream(cc_call_handle_t call, int streamId, bool i
|
||||
}
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
void CC_SIPCCService::deregisterStream(cc_call_handle_t call, int streamId)
|
||||
{
|
||||
// get the object corresponding to the handle
|
||||
@ -783,6 +813,9 @@ void CC_SIPCCService::deregisterStream(cc_call_handle_t call, int streamId)
|
||||
}
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
void CC_SIPCCService::dtmfBurst(int digit, int direction, int duration)
|
||||
{
|
||||
// We haven't a clue what stream to use. Search for a call which has an audio stream.
|
||||
@ -833,6 +866,9 @@ void CC_SIPCCService::dtmfBurst(int digit, int direction, int duration)
|
||||
}
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
void CC_SIPCCService::sendIFrame(cc_call_handle_t call_handle)
|
||||
{
|
||||
CC_SIPCCCallPtr callPtr = CC_SIPCCCall::wrap(call_handle);
|
||||
@ -886,6 +922,9 @@ void CC_SIPCCService::onVideoModeChanged( bool enable )
|
||||
{
|
||||
}
|
||||
|
||||
// !!! Note that accessing *Ptr instances from multiple threads can
|
||||
// lead to deadlocks, crashes, and spinning threads. Calls to this
|
||||
// method are not safe except from ccapp_thread.
|
||||
void CC_SIPCCService::onKeyFrameRequested( int stream )
|
||||
// This is called when the Video Provider indicates that it needs to send a request for new key frame to the sender
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user