From eb662bc407cec0585a821946fef123102cae64db Mon Sep 17 00:00:00 2001 From: bsalomon Date: Wed, 9 Sep 2015 18:05:03 -0700 Subject: Add a mutex to GrContext::readSurfacePixels to protect against multiple CPU raster threads accessing the same GrContext to read back GPU input data BUG=chromium:524717 TBR=reed@google.com Review URL: https://codereview.chromium.org/1329313002 --- include/gpu/GrContext.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/gpu') diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 7f1e4109fa..dcff3063b2 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -15,6 +15,7 @@ #include "GrRenderTarget.h" #include "GrTextureProvider.h" #include "SkMatrix.h" +#include "SkMutex.h" #include "SkPathEffect.h" #include "SkTypes.h" @@ -380,6 +381,11 @@ private: bool fDidTestPMConversions; int fPMToUPMConversion; int fUPMToPMConversion; + // The sw backend may call GrContext::readSurfacePixels on multiple threads + // We may transfer the responsibilty for using a mutex to the sw backend + // when there are fewer code paths that lead to a readSurfacePixels call + // from the sw backend. + SkMutex fReadPixelsMutex; struct CleanUpData { PFCleanUpFunc fFunc; -- cgit v1.2.3