Bug 1619906 - Remove AllocShmemParams from ImageBridgeChild r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D65300

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sotaro 2020-03-09 00:23:15 +00:00
parent c58ab473b3
commit daa0d75b55
2 changed files with 18 additions and 25 deletions

View File

@ -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> runnable =
WrapRunnable(RefPtr<ImageBridgeChild>(this),
&ImageBridgeChild::ProxyAllocShmemNow, &task, &params);
bool success = false;
RefPtr<Runnable> runnable = WrapRunnable(
RefPtr<ImageBridgeChild>(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,

View File

@ -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(