Bug 741319 - Delete textures using the same context used to create them, on the thread that owns that context. r=joe

This commit is contained in:
Ali Juma
2012-04-10 16:20:02 -04:00
parent a4c21ebc19
commit 074cef2a87
4 changed files with 29 additions and 7 deletions

View File

@@ -83,8 +83,8 @@ public:
void
GLTexture::Allocate(GLContext *aContext)
{
NS_ASSERTION(aContext->IsGlobalSharedContext() ||
NS_IsMainThread(), "Can only allocate texture on main thread or with cx sharing");
NS_ASSERTION(aContext->IsGlobalSharedContext() || aContext->IsOwningThreadCurrent(),
"Can only allocate texture on context's owning thread or with cx sharing");
Release();
@@ -122,13 +122,14 @@ GLTexture::Release()
}
if (mTexture) {
if (NS_IsMainThread() || mContext->IsGlobalSharedContext()) {
if (mContext->IsOwningThreadCurrent() || mContext->IsGlobalSharedContext()) {
mContext->MakeCurrent();
mContext->fDeleteTextures(1, &mTexture);
} else {
nsCOMPtr<nsIRunnable> runnable =
new TextureDeleter(mContext.forget(), mTexture);
NS_DispatchToMainThread(runnable);
new TextureDeleter(mContext.get(), mTexture);
mContext->DispatchToOwningThread(runnable);
mContext.forget();
}
mTexture = 0;