From b4fe562f900083917207a26f75c24ee81ce490bd Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 2 Dec 2015 11:59:07 -0800 Subject: [PATCH] Backed out changeset a52fb149b9ee (bug 1072501) for talos e10s failures resulting in crashes with UpdateFromSurface in the signature CLOSED TREE --HG-- extra : rebase_source : 9d5e20d8dad0357d00602feb0e42dfd605307616 --- gfx/layers/TextureDIB.cpp | 22 ++++++---------------- gfx/layers/client/TextureClient.cpp | 1 + 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/gfx/layers/TextureDIB.cpp b/gfx/layers/TextureDIB.cpp index 0a274d705d80..7dcaf3c21439 100644 --- a/gfx/layers/TextureDIB.cpp +++ b/gfx/layers/TextureDIB.cpp @@ -128,10 +128,7 @@ DIBTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface) } DataSourceSurface::MappedSurface sourceMap; - if (!srcSurf->Map(gfx::DataSourceSurface::READ, &sourceMap)) { - gfxCriticalError() << "Failed to map source surface for UpdateFromSurface."; - return false; - } + srcSurf->Map(DataSourceSurface::READ, &sourceMap); for (int y = 0; y < srcSurf->GetSize().height; y++) { memcpy(imgSurf->Data() + imgSurf->Stride() * y, @@ -233,9 +230,10 @@ ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, } uint8_t* data = (uint8_t*)::MapViewOfFile(fileMapping, FILE_MAP_WRITE | FILE_MAP_READ, - 0, 0, mapSize); + 0, 0, aSize.width * aSize.height + * BytesPerPixel(aFormat)); - memset(data, 0x80, mapSize); + memset(data, 0x80, aSize.width * aSize.height * BytesPerPixel(aFormat)); ::UnmapViewOfFile(fileMapping); @@ -389,14 +387,6 @@ TextureHostFileMapping::~TextureHostFileMapping() ::CloseHandle(mFileMapping); } -UserDataKey kFileMappingKey; - -static void UnmapFileData(void* aData) -{ - MOZ_ASSERT(aData); - ::UnmapViewOfFile(aData); -} - void TextureHostFileMapping::UpdatedInternal(const nsIntRegion* aRegion) { @@ -415,14 +405,14 @@ TextureHostFileMapping::UpdatedInternal(const nsIntRegion* aRegion) if (data) { RefPtr surf = Factory::CreateWrappingDataSourceSurface(data, mSize.width * BytesPerPixel(mFormat), mSize, mFormat); - surf->AddUserData(&kFileMappingKey, data, UnmapFileData); - if (!mTextureSource->Update(surf, const_cast(aRegion))) { mTextureSource = nullptr; } } else { mTextureSource = nullptr; } + + ::UnmapViewOfFile(data); } } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 7a5749e38163..3aed582d5d72 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -732,6 +732,7 @@ TextureClient::CreateForDrawing(CompositableForwarder* aAllocator, } if (!data && aFormat == SurfaceFormat::B8G8R8X8 && + aAllocator->IsSameProcess() && moz2DBackend == gfx::BackendType::CAIRO && NS_IsMainThread()) { data = DIBTextureData::Create(aSize, aFormat, aAllocator);