mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1435586 - Use static gfxPlatform methods directly instead of requiring initialization. r=kats
gfxPlatform::GetSourceSurfaceForSurface and CreateDrawTargetForSurface are both static methods that we sometimes use via the pattern gfxPlatform::GetPlatform()->... This is problematic because this forces gfxPlatform to be initialized in the process, and in the GPU process, we don't support this. It should be safe to call these methods without initializing gfxPlatform, so this patch removes the GetPlatform() call. GetSourceSurfaceForSurface may end up initializing gfxPlatform anyways, depending on whether or not a DrawTarget was given. This should not be a concern for the crashes observed in bug 1435586. Differential Revision: https://phabricator.services.mozilla.com/D33785
This commit is contained in:
parent
006ad2b250
commit
d639d2c5ac
@ -863,8 +863,7 @@ mozilla::ipc::IPCResult PluginInstanceParent::RecvShow(
|
||||
|
||||
bool isPlugin = true;
|
||||
RefPtr<gfx::SourceSurface> sourceSurface =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface,
|
||||
isPlugin);
|
||||
gfxPlatform::GetSourceSurfaceForSurface(nullptr, surface, isPlugin);
|
||||
RefPtr<SourceSurfaceImage> image =
|
||||
new SourceSurfaceImage(surface->GetSize(), sourceSurface);
|
||||
|
||||
@ -1051,9 +1050,8 @@ nsresult PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect,
|
||||
"Update outside of background area");
|
||||
#endif
|
||||
|
||||
RefPtr<gfx::DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(
|
||||
mBackground, gfx::IntSize(sz.width, sz.height));
|
||||
RefPtr<gfx::DrawTarget> dt = gfxPlatform::CreateDrawTargetForSurface(
|
||||
mBackground, gfx::IntSize(sz.width, sz.height));
|
||||
dt.forget(aDrawTarget);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -116,8 +116,7 @@ void DIBTextureData::FillInfo(TextureData::Info& aInfo) const {
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::DrawTarget> DIBTextureData::BorrowDrawTarget() {
|
||||
return gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mSurface,
|
||||
mSize);
|
||||
return gfxPlatform::CreateDrawTargetForSurface(mSurface, mSize);
|
||||
}
|
||||
|
||||
DIBTextureData* DIBTextureData::Create(gfx::IntSize aSize,
|
||||
|
@ -41,8 +41,8 @@ bool X11DataTextureSourceBasic::Update(gfx::DataSourceSurface* aSurface,
|
||||
surf = new gfxImageSurface(aSurface->GetSize(), imageFormat);
|
||||
}
|
||||
|
||||
mBufferDrawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(
|
||||
surf, aSurface->GetSize());
|
||||
mBufferDrawTarget =
|
||||
gfxPlatform::CreateDrawTargetForSurface(surf, aSurface->GetSize());
|
||||
}
|
||||
|
||||
// Image contents have changed, upload to our DrawTarget
|
||||
|
@ -506,8 +506,7 @@ RefPtr<RotatedBuffer> ContentClientBasic::CreateBuffer(gfxContentType aType,
|
||||
RefPtr<gfxASurface> surf = new gfxWindowsSurface(
|
||||
size, aType == gfxContentType::COLOR ? gfxImageFormat::X8R8G8B8_UINT32
|
||||
: gfxImageFormat::A8R8G8B8_UINT32);
|
||||
drawTarget =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf, size);
|
||||
drawTarget = gfxPlatform::CreateDrawTargetForSurface(surf, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -36,8 +36,7 @@ already_AddRefed<DrawTarget> PrintTargetThebes::MakeDrawTarget(
|
||||
MOZ_ASSERT(mHasActivePage, "We can't guarantee a valid DrawTarget");
|
||||
|
||||
RefPtr<gfx::DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mGfxSurface,
|
||||
aSize);
|
||||
gfxPlatform::CreateDrawTargetForSurface(mGfxSurface, aSize);
|
||||
if (!dt || !dt->IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -55,8 +54,7 @@ already_AddRefed<DrawTarget> PrintTargetThebes::MakeDrawTarget(
|
||||
already_AddRefed<DrawTarget> PrintTargetThebes::GetReferenceDrawTarget() {
|
||||
if (!mRefDT) {
|
||||
RefPtr<gfx::DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mGfxSurface,
|
||||
mSize);
|
||||
gfxPlatform::CreateDrawTargetForSurface(mGfxSurface, mSize);
|
||||
if (!dt || !dt->IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -280,11 +280,10 @@ already_AddRefed<gfxImageSurface> gfxASurface::CopyToARGB32ImageSurface() {
|
||||
RefPtr<gfxImageSurface> imgSurface =
|
||||
new gfxImageSurface(size, SurfaceFormat::A8R8G8B8_UINT32);
|
||||
|
||||
RefPtr<DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(
|
||||
imgSurface, IntSize(size.width, size.height));
|
||||
RefPtr<DrawTarget> dt = gfxPlatform::CreateDrawTargetForSurface(
|
||||
imgSurface, IntSize(size.width, size.height));
|
||||
RefPtr<SourceSurface> source =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, this);
|
||||
gfxPlatform::GetSourceSurfaceForSurface(dt, this);
|
||||
|
||||
dt->CopySurface(source, IntRect(0, 0, size.width, size.height), IntPoint());
|
||||
|
||||
|
@ -500,8 +500,7 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
|
||||
// wrap the cached cairo_surface_t from ScreenReferenceSurface():
|
||||
RefPtr<gfxASurface> refSurf =
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceSurface();
|
||||
tmpDT = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(
|
||||
refSurf, IntSize(1, 1));
|
||||
tmpDT = gfxPlatform::CreateDrawTargetForSurface(refSurf, IntSize(1, 1));
|
||||
#else
|
||||
tmpDT = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
#endif
|
||||
|
@ -38,8 +38,7 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceXRender::Lock(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mXlibSurface,
|
||||
size);
|
||||
return gfxPlatform::CreateDrawTargetForSurface(mXlibSurface, size);
|
||||
}
|
||||
|
||||
void WindowSurfaceXRender::Commit(const LayoutDeviceIntRegion& aInvalidRegion) {
|
||||
|
@ -326,7 +326,7 @@ class nsAutoRetainUIKitObject {
|
||||
targetSurface = new gfxQuartzSurface(aContext, backingSize);
|
||||
targetSurface->SetAllowUseAsSource(false);
|
||||
RefPtr<gfx::DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(targetSurface, backingSize);
|
||||
gfxPlatform::CreateDrawTargetForSurface(targetSurface, backingSize);
|
||||
if (!dt || !dt->IsValid()) {
|
||||
gfxDevCrash(mozilla::gfx::LogReason::InvalidContext)
|
||||
<< "Window context problem 2 " << backingSize;
|
||||
|
@ -318,10 +318,9 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||
|
||||
RECT paintRect;
|
||||
::GetClientRect(mWnd, &paintRect);
|
||||
RefPtr<DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(
|
||||
targetSurface, IntSize(paintRect.right - paintRect.left,
|
||||
paintRect.bottom - paintRect.top));
|
||||
RefPtr<DrawTarget> dt = gfxPlatform::CreateDrawTargetForSurface(
|
||||
targetSurface, IntSize(paintRect.right - paintRect.left,
|
||||
paintRect.bottom - paintRect.top));
|
||||
if (!dt || !dt->IsValid()) {
|
||||
gfxWarning()
|
||||
<< "nsWindow::OnPaint failed in CreateDrawTargetForSurface";
|
||||
|
Loading…
Reference in New Issue
Block a user