mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 943392 - Let MemoryTextureClient use a fallible allocation. r=BenWa
This commit is contained in:
parent
267221ccf0
commit
acd8439101
@ -213,7 +213,12 @@ bool
|
||||
MemoryTextureClient::Allocate(uint32_t aSize)
|
||||
{
|
||||
MOZ_ASSERT(!mBuffer);
|
||||
mBuffer = new uint8_t[aSize];
|
||||
static const fallible_t fallible = fallible_t();
|
||||
mBuffer = new(fallible) uint8_t[aSize];
|
||||
if (!mBuffer) {
|
||||
NS_WARNING("Failed to allocate buffer");
|
||||
return false;
|
||||
}
|
||||
GfxMemoryImageReporter::DidAlloc(mBuffer);
|
||||
mBufSize = aSize;
|
||||
return true;
|
||||
|
@ -84,8 +84,11 @@ CreateSharedRGBImage(ImageContainer *aImageContainer,
|
||||
return rgbImageDep.forget();
|
||||
}
|
||||
nsRefPtr<SharedRGBImage> rgbImage = static_cast<SharedRGBImage*>(image.get());
|
||||
rgbImage->Allocate(gfx::ToIntSize(aSize),
|
||||
gfx::ImageFormatToSurfaceFormat(aImageFormat));
|
||||
if (!rgbImage->Allocate(gfx::ToIntSize(aSize),
|
||||
gfx::ImageFormatToSurfaceFormat(aImageFormat))) {
|
||||
NS_WARNING("Failed to allocate a shared image");
|
||||
return nullptr;
|
||||
}
|
||||
return image.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user