本文整理汇总了C++中FileService::ThreadPoolTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ FileService::ThreadPoolTarget方法的具体用法?C++ FileService::ThreadPoolTarget怎么用?C++ FileService::ThreadPoolTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileService
的用法示例。
在下文中一共展示了FileService::ThreadPoolTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileOutputStreamWrapper
nsresult
WriteHelper::DoAsyncRun(nsISupports* aStream)
{
MOZ_ASSERT(aStream, "Passed a null stream!");
uint32_t flags = FileStreamWrapper::NOTIFY_PROGRESS;
nsCOMPtr<nsIOutputStream> ostream =
new FileOutputStreamWrapper(aStream, this, mLocation, mLength, flags);
FileService* service = FileService::Get();
MOZ_ASSERT(service, "This should never be null");
nsIEventTarget* target = service->ThreadPoolTarget();
nsCOMPtr<nsIAsyncStreamCopier> copier;
nsresult rv =
NS_NewAsyncStreamCopier(getter_AddRefs(copier), mStream, ostream, target,
true, false, STREAM_COPY_BLOCK_SIZE);
NS_ENSURE_SUCCESS(rv, rv);
rv = copier->AsyncCopy(this, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
mRequest = do_QueryInterface(copier);
return NS_OK;
}
示例2: helper
nsresult
FileHandleBase::Finish()
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
nsRefPtr<FinishHelper> helper(new FinishHelper(this));
FileService* service = FileService::Get();
MOZ_ASSERT(service, "This should never be null");
nsIEventTarget* target = service->ThreadPoolTarget();
nsresult rv = target->Dispatch(helper, NS_DISPATCH_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}