diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index c9470f72d9fe..9a09dbd88135 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -779,18 +779,10 @@ bool ImageBridgeChild::AllocShmem(size_t aSize, return PImageBridgeChild::AllocShmem(aSize, aType, aShmem); } -// NewRunnableFunction accepts a limited number of parameters so we need a -// struct here -struct AllocShmemParams { - size_t mSize; - ipc::SharedMemory::SharedMemoryType mType; - ipc::Shmem* mShmem; - bool mUnsafe; - bool mSuccess; -}; - -void ImageBridgeChild::ProxyAllocShmemNow(SynchronousTask* aTask, - AllocShmemParams* aParams) { +void ImageBridgeChild::ProxyAllocShmemNow(SynchronousTask* aTask, size_t aSize, + SharedMemory::SharedMemoryType aType, + ipc::Shmem* aShmem, bool aUnsafe, + bool* aSuccess) { AutoCompleteTask complete(aTask); if (!CanSend()) { @@ -798,12 +790,12 @@ void ImageBridgeChild::ProxyAllocShmemNow(SynchronousTask* aTask, } bool ok = false; - if (aParams->mUnsafe) { - ok = AllocUnsafeShmem(aParams->mSize, aParams->mType, aParams->mShmem); + if (aUnsafe) { + ok = AllocUnsafeShmem(aSize, aType, aShmem); } else { - ok = AllocShmem(aParams->mSize, aParams->mType, aParams->mShmem); + ok = AllocShmem(aSize, aType, aShmem); } - aParams->mSuccess = ok; + *aSuccess = ok; } bool ImageBridgeChild::DispatchAllocShmemInternal( @@ -811,16 +803,15 @@ bool ImageBridgeChild::DispatchAllocShmemInternal( bool aUnsafe) { SynchronousTask task("AllocatorProxy alloc"); - AllocShmemParams params = {aSize, aType, aShmem, aUnsafe, false}; - - RefPtr runnable = - WrapRunnable(RefPtr(this), - &ImageBridgeChild::ProxyAllocShmemNow, &task, ¶ms); + bool success = false; + RefPtr runnable = WrapRunnable( + RefPtr(this), &ImageBridgeChild::ProxyAllocShmemNow, + &task, aSize, aType, aShmem, aUnsafe, &success); GetMessageLoop()->PostTask(runnable.forget()); task.Wait(); - return params.mSuccess; + return success; } void ImageBridgeChild::ProxyDeallocShmemNow(SynchronousTask* aTask, diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index 73654c3e8d5e..646a2a3eccc1 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -48,7 +48,6 @@ struct CompositableTransaction; class Image; class TextureClient; class SynchronousTask; -struct AllocShmemParams; /** * Returns true if the current thread is the ImageBrdigeChild's thread. @@ -246,8 +245,11 @@ class ImageBridgeChild final : public PImageBridgeChild, void FlushAllImagesSync(SynchronousTask* aTask, ImageClient* aClient, ImageContainer* aContainer); - void ProxyAllocShmemNow(SynchronousTask* aTask, AllocShmemParams* aParams); - void ProxyDeallocShmemNow(SynchronousTask* aTask, Shmem* aShmem, + void ProxyAllocShmemNow(SynchronousTask* aTask, size_t aSize, + SharedMemory::SharedMemoryType aType, + mozilla::ipc::Shmem* aShmem, bool aUnsafe, + bool* aSuccess); + void ProxyDeallocShmemNow(SynchronousTask* aTask, mozilla::ipc::Shmem* aShmem, bool* aResult); void UpdateTextureFactoryIdentifier(