Backout 6c89d2b6ea4b (bug 793175) on suspicion of somehow causing Win7 opt permaorange in browser_updatessl.js and friends

This commit is contained in:
Ed Morley 2012-10-08 10:31:57 +01:00
parent b112ca967d
commit ae328bf180

View File

@ -489,22 +489,9 @@ gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aS
cairo_user_data_key_t kSourceSurface;
/**
* Record the backend that was used to construct the SourceSurface.
* When getting the cached SourceSurface for a gfxASurface/DrawTarget pair,
* we check to make sure the DrawTarget's backend matches the backend
* for the cached SourceSurface, and only use it if they match. This
* can avoid expensive and unnecessary readbacks.
*/
struct SourceSurfaceUserData
void SourceBufferDestroy(void *srcBuffer)
{
RefPtr<SourceSurface> mSrcSurface;
BackendType mBackendType;
};
void SourceBufferDestroy(void *srcSurfUD)
{
delete static_cast<SourceSurfaceUserData*>(srcSurfUD);
static_cast<SourceSurface*>(srcBuffer)->Release();
}
void SourceSnapshotDetached(cairo_surface_t *nullSurf)
@ -521,10 +508,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
void *userData = aSurface->GetData(&kSourceSurface);
if (userData) {
SourceSurfaceUserData *surf = static_cast<SourceSurfaceUserData*>(userData);
SourceSurface *surf = static_cast<SourceSurface*>(userData);
if (surf->mSrcSurface->IsValid() && surf->mBackendType == aTarget->GetType()) {
return surf->mSrcSurface;
if (surf->IsValid()) {
return surf;
}
// We can just continue here as when setting new user data the destroy
// function will be called for the old user data.
@ -637,11 +624,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
}
srcBuffer->AddRef();
SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData;
srcSurfUD->mBackendType = aTarget->GetType();
srcSurfUD->mSrcSurface = srcBuffer;
aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
aSurface->SetData(&kSourceSurface, srcBuffer, SourceBufferDestroy);
return srcBuffer;
}