Add an RAII class to lock and unlock textures. (bug 1222863 part 1, r=nical)

This commit is contained in:
David Anderson
2015-11-10 23:58:21 -08:00
parent 2ac5ab320b
commit 20d7da52cc
3 changed files with 36 additions and 12 deletions

View File

@@ -650,12 +650,11 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
return nullptr;
}
if (!textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
TextureClientAutoLock autoLock(textureClient, OpenMode::OPEN_WRITE_ONLY);
if (!autoLock.Succeeded()) {
return nullptr;
}
TextureClientAutoUnlock autoUnlock(textureClient);
textureClient->UpdateFromSurface(surface);
textureClient->SyncWithObject(forwarder->GetSyncObject());