This source file includes following definitions.
- create
- m_scheduledEventTimer
- requestSucceeded
- scheduledEventTimerFired
#include "config.h"
#include "modules/mediastream/MediaStreamTrackSourcesRequestImpl.h"
#include "modules/mediastream/MediaStreamTrackSourcesCallback.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/WebSourceInfo.h"
#include "wtf/PassOwnPtr.h"
namespace WebCore {
PassRefPtr<MediaStreamTrackSourcesRequestImpl> MediaStreamTrackSourcesRequestImpl::create(const String& origin, PassOwnPtr<MediaStreamTrackSourcesCallback> callback)
{
return adoptRef(new MediaStreamTrackSourcesRequestImpl(origin, callback));
}
MediaStreamTrackSourcesRequestImpl::MediaStreamTrackSourcesRequestImpl(const String& origin, PassOwnPtr<MediaStreamTrackSourcesCallback> callback)
: m_callback(callback)
, m_scheduledEventTimer(this, &MediaStreamTrackSourcesRequestImpl::scheduledEventTimerFired)
{
m_origin = origin;
}
MediaStreamTrackSourcesRequestImpl::~MediaStreamTrackSourcesRequestImpl()
{
}
void MediaStreamTrackSourcesRequestImpl::requestSucceeded(const blink::WebVector<blink::WebSourceInfo>& webSourceInfos)
{
ASSERT(m_callback && !m_scheduledEventTimer.isActive());
for (size_t i = 0; i < webSourceInfos.size(); ++i)
m_sourceInfos.append(SourceInfo::create(webSourceInfos[i]));
m_protect = this;
m_scheduledEventTimer.startOneShot(0, FROM_HERE);
}
void MediaStreamTrackSourcesRequestImpl::scheduledEventTimerFired(Timer<MediaStreamTrackSourcesRequestImpl>*)
{
m_callback->handleEvent(m_sourceInfos);
m_callback.clear();
m_protect.release();
}
}