Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: src/gpu/GrContext.cpp

Issue 1321353002: Limit lifetime of GrDrawContext objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index a934501a6c0127a1d8a226ea2d30607b64eac538..ee9942e5391ef91519396c5e442c74db47dec79f 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -125,7 +125,8 @@ GrDrawContext* GrContext::DrawingMgr::drawContext(const SkSurfaceProps* surfaceP
new GrDrawContext(fContext, fDrawTarget, props);
}
- return fDrawContext[props.pixelGeometry()][props.isUseDeviceIndependentFonts()];
+ // For now, everyone gets a faux creation ref
+ return SkRef(fDrawContext[props.pixelGeometry()][props.isUseDeviceIndependentFonts()]);
}
////////////////////////////////////////////////////////////////////////////////
@@ -423,7 +424,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
- GrDrawContext* drawContext = this->drawContext();
+ SkAutoTUnref<GrDrawContext> drawContext(this->drawContext());
if (!drawContext) {
return false;
}
@@ -534,7 +535,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
if (fp) {
paint.addColorFragmentProcessor(fp);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
- GrDrawContext* drawContext = this->drawContext();
+ SkAutoTUnref<GrDrawContext> drawContext(this->drawContext());
drawContext->drawRect(temp->asRenderTarget(), GrClip::WideOpen(), paint,
SkMatrix::I(), rect, nullptr);
surfaceToRead.reset(SkRef(temp.get()));
@@ -610,7 +611,7 @@ void GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
return;
}
- GrDrawContext* drawContext = this->drawContext();
+ SkAutoTUnref<GrDrawContext> drawContext(this->drawContext());
if (!drawContext) {
return;
}
« no previous file with comments | « src/gpu/GrBlurUtils.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | src/gpu/GrRenderTarget.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698