本文整理汇总了C++中InImageBridgeChildThread函数的典型用法代码示例。如果您正苦于以下问题:C++ InImageBridgeChildThread函数的具体用法?C++ InImageBridgeChildThread怎么用?C++ InImageBridgeChildThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InImageBridgeChildThread函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CreateImageContainerChildNow
already_AddRefed<ImageContainerChild> ImageBridgeChild::CreateImageContainerChild()
{
if (InImageBridgeChildThread()) {
return ImageBridgeChild::CreateImageContainerChildNow();
}
// ImageContainerChild can only be alocated on the ImageBridgeChild thread, so se
// dispatch a task to the thread and block the current thread until the task has been
// executed.
nsRefPtr<ImageContainerChild> result = nullptr;
ReentrantMonitor barrier("CreateImageContainerChild Lock");
ReentrantMonitorAutoEnter autoMon(barrier);
bool done = false;
GetMessageLoop()->PostTask(FROM_HERE, NewRunnableFunction(&CreateContainerChildSync,
&result, &barrier, &done));
// should stop the thread until the ImageContainerChild has been created on
// the other thread
while (!done) {
barrier.Wait();
}
return result.forget();
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:25,代码来源:ImageBridgeChild.cpp
示例2: MOZ_ASSERT
void
AsyncTransactionWaiter::WaitComplete()
{
MOZ_ASSERT(!InImageBridgeChildThread());
MonitorAutoLock mon(mCompletedMonitor);
int count = 0;
const int maxCount = 5;
while (mWaitCount > 0 && (count < maxCount)) {
if (!NS_SUCCEEDED(mCompletedMonitor.Wait(PR_MillisecondsToInterval(10000)))) {
NS_WARNING("Failed to wait Monitor");
return;
}
if (count > 1) {
printf_stderr("Waiting async transaction complete.\n");
}
count++;
}
if (mWaitCount > 0) {
printf_stderr("Timeout of waiting transaction complete.");
}
if (count == maxCount) {
gfxDevCrash(gfx::LogReason::AsyncTransactionTimeout) << "Bug 1244883: AsyncTransactionWaiter timed out.";
}
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:27,代码来源:AsyncTransactionTracker.cpp
示例3: NS_ABORT_IF_FALSE
void ImageContainerChild::SendImageNow(Image* aImage)
{
NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
"Should be in ImageBridgeChild thread.");
if (mStop) {
return;
}
bool needsCopy = false;
// If the image can be converted to a shared image, no need to do a copy.
SharedImage* img = AsSharedImage(aImage);
if (!img) {
needsCopy = true;
// Try to get a compatible shared image from the pool
img = GetSharedImageFor(aImage);
if (!img && mActiveImageCount < (int)MAX_ACTIVE_SHARED_IMAGES) {
// If no shared image available, allocate a new one
img = AllocateSharedImageFor(aImage);
}
}
if (img && (!needsCopy || CopyDataIntoSharedImage(aImage, img))) {
// Keep a reference to the image we sent to compositor to maintain a
// correct reference count.
mImageQueue.AppendElement(aImage);
SendPublishImage(*img);
} else {
NS_WARNING("Failed to send an image to the compositor");
}
delete img;
return;
}
开发者ID:mihaisucan,项目名称:devtools-window,代码行数:33,代码来源:ImageContainerChild.cpp
示例4: SendImageAsync
void ImageContainerChild::SendImageAsync(ImageContainer* aContainer,
Image* aImage)
{
if(!aContainer || !aImage) {
return;
}
if (mStop) {
return;
}
if (InImageBridgeChildThread()) {
SharedImage *img = ImageToSharedImage(aImage);
if (img) {
SendPublishImage(*img);
} else {
NS_WARNING("Failed to create a shared image!");
}
delete img;
return;
}
// Sending images and (potentially) allocating shmems must be done
// on the ImageBridgeChild thread.
Task *t = new ImageBridgeCopyAndSendTask(this, aContainer, aImage);
GetMessageLoop()->PostTask(FROM_HERE, t);
}
开发者ID:sergecodd,项目名称:FireFox-OS,代码行数:27,代码来源:ImageContainerChild.cpp
示例5: ImageBridgeShutdownStep1
// dispatched function
static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone)
{
ReentrantMonitorAutoEnter autoMon(*aBarrier);
MOZ_ASSERT(InImageBridgeChildThread(),
"Should be in ImageBridgeChild thread.");
MediaSystemResourceManager::Shutdown();
if (sImageBridgeChildSingleton) {
// Force all managed protocols to shut themselves down cleanly
InfallibleTArray<PCompositableChild*> compositables;
sImageBridgeChildSingleton->ManagedPCompositableChild(compositables);
for (int i = compositables.Length() - 1; i >= 0; --i) {
CompositableClient::FromIPDLActor(compositables[i])->Destroy();
}
InfallibleTArray<PTextureChild*> textures;
sImageBridgeChildSingleton->ManagedPTextureChild(textures);
for (int i = textures.Length() - 1; i >= 0; --i) {
TextureClient* client = TextureClient::AsTextureClient(textures[i]);
if (client) {
client->ForceRemove();
}
}
sImageBridgeChildSingleton->SendWillStop();
sImageBridgeChildSingleton->MarkShutDown();
// From now on, no message can be sent through the image bridge from the
// client side except the final Stop message.
}
*aDone = true;
aBarrier->NotifyAll();
}
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:34,代码来源:ImageBridgeChild.cpp
示例6: NS_ABORT_IF_FALSE
void ImageBridgeChild::DestroyBridge()
{
NS_ABORT_IF_FALSE(!InImageBridgeChildThread(),
"This method must not be called in this thread.");
// ...because we are about to dispatch synchronous messages to the
// ImageBridgeChild thread.
if (!IsCreated()) {
return;
}
ReentrantMonitor barrier("ImageBridgeDestroyTask lock");
ReentrantMonitorAutoEnter autoMon(barrier);
bool done = false;
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(FROM_HERE,
NewRunnableFunction(&StopImageBridgeSync, &barrier, &done));
while (!done) {
barrier.Wait();
}
done = false;
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(FROM_HERE,
NewRunnableFunction(&DeleteImageBridgeSync, &barrier, &done));
while (!done) {
barrier.Wait();
}
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:29,代码来源:ImageBridgeChild.cpp
示例7: MOZ_COUNT_DTOR
SharedRGBImage::~SharedRGBImage()
{
MOZ_COUNT_DTOR(SharedRGBImage);
if (mCompositable->GetAsyncID() != 0 &&
!InImageBridgeChildThread()) {
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient.forget().drop());
ImageBridgeChild::DispatchReleaseImageClient(mCompositable.forget().drop());
}
}
开发者ID:Gabuzo,项目名称:mozilla-central,代码行数:10,代码来源:SharedRGBImage.cpp
示例8: DeleteImageBridgeSync
// dispatched function
static void DeleteImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
{
ReentrantMonitorAutoEnter autoMon(*aBarrier);
NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
"Should be in ImageBridgeChild thread.");
delete sImageBridgeChildSingleton;
sImageBridgeChildSingleton = nullptr;
*aDone = true;
aBarrier->NotifyAll();
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:12,代码来源:ImageBridgeChild.cpp
示例9: ReleaseImageClientNow
static void ReleaseImageClientNow(ImageClient* aClient,
PImageContainerChild* aChild)
{
MOZ_ASSERT(InImageBridgeChildThread());
if (aClient) {
aClient->Release();
}
if (aChild) {
aChild->SendAsyncDelete();
}
}
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:11,代码来源:ImageBridgeChild.cpp
示例10: MOZ_ASSERT
//static
void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront)
{
if (!IsCreated()) {
return;
}
MOZ_ASSERT(aClient);
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
MOZ_ASSERT(!InImageBridgeChildThread());
if (InImageBridgeChildThread()) {
NS_ERROR("ImageBridgeChild::FlushAllImages() is called on ImageBridge thread.");
return;
}
RefPtr<AsyncTransactionTracker> status = aClient->PrepareFlushAllImages();
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction(&FlushAllImagesSync, aClient, aContainer, aExceptFront, status));
status->WaitComplete();
}
开发者ID:afabbro,项目名称:gecko-dev,代码行数:22,代码来源:ImageBridgeChild.cpp
示例11: ImageBridgeShutdownStep2
// dispatched function
static void ImageBridgeShutdownStep2(ReentrantMonitor *aBarrier, bool *aDone)
{
ReentrantMonitorAutoEnter autoMon(*aBarrier);
MOZ_ASSERT(InImageBridgeChildThread(),
"Should be in ImageBridgeChild thread.");
sImageBridgeChildSingleton->SendStop();
*aDone = true;
aBarrier->NotifyAll();
}
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:13,代码来源:ImageBridgeChild.cpp
示例12: DispatchImageClientUpdate
//static
void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
ImageContainer* aContainer)
{
if (InImageBridgeChildThread()) {
UpdateImageClientNow(aClient, aContainer);
return;
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction<
void (*)(ImageClient*, ImageContainer*),
ImageClient*,
nsRefPtr<ImageContainer> >(&UpdateImageClientNow, aClient, aContainer));
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:15,代码来源:ImageBridgeChild.cpp
示例13: MOZ_ASSERT
//static
void ImageBridgeChild::FlushAllImages(ImageClient* aClient,
ImageContainer* aContainer)
{
if (!IsCreated()) {
return;
}
MOZ_ASSERT(aClient);
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
MOZ_ASSERT(!InImageBridgeChildThread());
if (InImageBridgeChildThread()) {
NS_ERROR("ImageBridgeChild::FlushAllImages() is called on ImageBridge thread.");
return;
}
RefPtr<AsyncTransactionWaiter> waiter = new AsyncTransactionWaiter();
// This increment is balanced by the decrement in FlushAllImagesSync
waiter->IncrementWaitCount();
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction(&FlushAllImagesSync, aClient, aContainer, waiter));
waiter->WaitComplete();
}
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:25,代码来源:ImageBridgeChild.cpp
示例14: SetIdle
void ImageContainerChild::SetIdle()
{
if (mStop) return;
if (InImageBridgeChildThread()) {
return SetIdleNow();
}
Monitor barrier("SetIdle Lock");
MonitorAutoLock autoMon(barrier);
bool done = false;
GetMessageLoop()->PostTask(FROM_HERE,
NewRunnableMethod(this, &ImageContainerChild::SetIdleSync, &barrier, &done));
while (!done) {
barrier.Wait();
}
}
开发者ID:sergecodd,项目名称:FireFox-OS,代码行数:19,代码来源:ImageContainerChild.cpp
示例15: SendImageAsync
void ImageContainerChild::SendImageAsync(ImageContainer* aContainer,
Image* aImage)
{
if(!aContainer || !aImage) {
return;
}
if (mStop) {
return;
}
if (InImageBridgeChildThread()) {
SendImageNow(aImage);
}
// Sending images and (potentially) allocating shmems must be done
// on the ImageBridgeChild thread.
Task *t = new ImageBridgeCopyAndSendTask(this, aContainer, aImage);
GetMessageLoop()->PostTask(FROM_HERE, t);
}
开发者ID:mihaisucan,项目名称:devtools-window,代码行数:20,代码来源:ImageContainerChild.cpp
示例16: DeallocSurfaceDescriptorGrallocNow
bool
ImageBridgeChild::DeallocSurfaceDescriptorGralloc(const SurfaceDescriptor& aBuffer)
{
if (InImageBridgeChildThread()) {
return ImageBridgeChild::DeallocSurfaceDescriptorGrallocNow(aBuffer);
}
Monitor barrier("DeallocSurfaceDescriptor Lock");
MonitorAutoLock autoMon(barrier);
bool done = false;
GetMessageLoop()->PostTask(FROM_HERE, NewRunnableFunction(&DeallocSurfaceDescriptorGrallocSync,
aBuffer, &barrier, &done));
while (!done) {
barrier.Wait();
}
return true;
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:20,代码来源:ImageBridgeChild.cpp
示例17: NS_WARNING
// static
void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
ImageContainer* aContainer)
{
if (!ImageBridgeChild::IsCreated() || ImageBridgeChild::IsShutDown()) {
NS_WARNING("Something is holding on to graphics resources after the shutdown"
"of the graphics subsystem!");
return;
}
if (!aClient || !aContainer || !IsCreated()) {
return;
}
if (InImageBridgeChildThread()) {
UpdateImageClientNow(aClient, aContainer);
return;
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction(&UpdateImageClientNow, aClient, RefPtr<ImageContainer>(aContainer)));
}
开发者ID:Eroppo,项目名称:cyberfox-beta,代码行数:21,代码来源:ImageBridgeChild.cpp
注:本文中的InImageBridgeChildThread函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论