本文整理汇总了C++中nsRefPtr::EnsureTaskQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ nsRefPtr::EnsureTaskQueue方法的具体用法?C++ nsRefPtr::EnsureTaskQueue怎么用?C++ nsRefPtr::EnsureTaskQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsRefPtr
的用法示例。
在下文中一共展示了nsRefPtr::EnsureTaskQueue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BufferMediaResource
bool
MediaDecodeTask::CreateReader()
{
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<BufferMediaResource> resource =
new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
mLength, mPrincipal, mContentType);
MOZ_ASSERT(!mBufferDecoder);
mBufferDecoder = new BufferDecoder(resource);
// If you change this list to add support for new decoders, please consider
// updating HTMLMediaElement::CreateDecoder as well.
mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder);
if (!mDecoderReader) {
return false;
}
nsresult rv = mDecoderReader->Init(nullptr);
if (NS_FAILED(rv)) {
return false;
}
if (!mDecoderReader->EnsureTaskQueue()) {
return false;
}
return true;
}
示例2: TestBinding
explicit TestBinding(const char* aFileName = "gizmo.mp4")
: decoder(new MP4Decoder())
, resource(new MockMediaResource(aFileName))
, reader(new MP4Reader(decoder))
{
EXPECT_EQ(NS_OK, Preferences::SetBool(
"media.fragmented-mp4.use-blank-decoder", true));
EXPECT_EQ(NS_OK, resource->Open(nullptr));
decoder->SetResource(resource);
reader->Init(nullptr);
reader->EnsureTaskQueue();
{
// This needs to be done before invoking GetBuffered. This is normally
// done by MediaDecoderStateMachine.
ReentrantMonitorAutoEnter mon(decoder->GetReentrantMonitor());
reader->SetStartTime(0);
}
}
示例3: BufferMediaResource
bool
MediaDecodeTask::CreateReader()
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIPrincipal> principal;
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(mDecodeJob.mContext->GetParentObject());
if (sop) {
principal = sop->GetPrincipal();
}
nsRefPtr<BufferMediaResource> resource =
new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
mLength, principal, mContentType);
MOZ_ASSERT(!mBufferDecoder);
mBufferDecoder = new BufferDecoder(resource);
// If you change this list to add support for new decoders, please consider
// updating HTMLMediaElement::CreateDecoder as well.
mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder);
if (!mDecoderReader) {
return false;
}
nsresult rv = mDecoderReader->Init(nullptr);
if (NS_FAILED(rv)) {
return false;
}
if (!mDecoderReader->EnsureTaskQueue()) {
return false;
}
return true;
}