This source file includes following definitions.
- create
- m_component
- createResponse
- hasSelector
- component
- requestSucceeded
- stop
- clear
#include "config.h"
#include "modules/mediastream/RTCStatsRequestImpl.h"
#include "modules/mediastream/MediaStreamTrack.h"
#include "modules/mediastream/RTCStatsCallback.h"
namespace WebCore {
PassRefPtr<RTCStatsRequestImpl> RTCStatsRequestImpl::create(ExecutionContext* context, PassOwnPtr<RTCStatsCallback> callback, PassRefPtr<MediaStreamTrack> selector)
{
RefPtr<RTCStatsRequestImpl> request = adoptRef(new RTCStatsRequestImpl(context, callback, selector));
request->suspendIfNeeded();
return request.release();
}
RTCStatsRequestImpl::RTCStatsRequestImpl(ExecutionContext* context, PassOwnPtr<RTCStatsCallback> callback, PassRefPtr<MediaStreamTrack> selector)
: ActiveDOMObject(context)
, m_successCallback(callback)
, m_component(selector ? selector->component() : 0)
{
}
RTCStatsRequestImpl::~RTCStatsRequestImpl()
{
}
PassRefPtr<RTCStatsResponseBase> RTCStatsRequestImpl::createResponse()
{
return RTCStatsResponse::create();
}
bool RTCStatsRequestImpl::hasSelector()
{
return m_component;
}
MediaStreamComponent* RTCStatsRequestImpl::component()
{
return m_component.get();
}
void RTCStatsRequestImpl::requestSucceeded(PassRefPtr<RTCStatsResponseBase> response)
{
if (!m_successCallback)
return;
m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response.get()));
clear();
}
void RTCStatsRequestImpl::stop()
{
clear();
}
void RTCStatsRequestImpl::clear()
{
m_successCallback.clear();
}
}