From 94da292e39db0d41da08b1d6055ca5e0d6b498cc Mon Sep 17 00:00:00 2001 From: joshualitt Date: Thu, 7 Jan 2016 13:22:24 -0800 Subject: Revert of Make a single GrSingleOwner in GrContext (patchset #3 id:40001 of https://codereview.chromium.org/1563703004/ ) Reason for revert: breaking asan Original issue's description: > Make a single GrSingleOwner in GrContext > > TBR=bsalomon@google.com > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1563703004 > > Committed: https://skia.googlesource.com/skia/+/f9bc796e0dbd31674c22b34761913ee6e8fdd66a TBR=robertphillips@google.com,joshualitt@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1565303003 --- include/gpu/GrContext.h | 4 +--- include/gpu/GrDrawContext.h | 5 ++--- include/private/GrSingleOwner.h | 2 -- src/gpu/GrContext.cpp | 2 +- src/gpu/GrDrawContext.cpp | 8 +++----- src/gpu/GrDrawingManager.cpp | 2 +- src/gpu/GrDrawingManager.h | 8 +------- 7 files changed, 9 insertions(+), 22 deletions(-) diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index baf99789c0..39477e0db8 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -392,9 +392,7 @@ private: SkMutex fTestPMConversionsMutex; // In debug builds we guard against improper thread handling - // This guard is passed to the GrDrawingManager and, from there to all the - // GrDrawContexts. It is also passed to the GrTextureProvider and SkGpuDevice. - mutable GrSingleOwner fSingleOwner; + SkDEBUGCODE(mutable GrSingleOwner fSingleOwner;) struct CleanUpData { PFCleanUpFunc fFunc; diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index 7ae6f5e682..21977bed74 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -283,8 +283,7 @@ private: SkDEBUGCODE(void validate() const;) - GrDrawContext(GrDrawingManager*, GrRenderTarget*, const SkSurfaceProps* surfaceProps, - GrSingleOwner*); + GrDrawContext(GrDrawingManager*, GrRenderTarget*, const SkSurfaceProps* surfaceProps); void internalDrawPath(GrPipelineBuilder*, const SkMatrix& viewMatrix, @@ -310,7 +309,7 @@ private: SkSurfaceProps fSurfaceProps; // In debug builds we guard against improper thread handling - mutable GrSingleOwner* fSingleOwner; + SkDEBUGCODE(mutable GrSingleOwner fSingleOwner;) }; #endif diff --git a/include/private/GrSingleOwner.h b/include/private/GrSingleOwner.h index 64e63d3b19..dea982e89a 100644 --- a/include/private/GrSingleOwner.h +++ b/include/private/GrSingleOwner.h @@ -48,8 +48,6 @@ private: SkThreadID fOwner; // guarded by fMutex int fReentranceCount; // guarded by fMutex }; -#else -class GrSingleOwner {}; // Provide a dummy implementation so we can pass pointers to constructors #endif #endif diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 2bf887c7f0..854ff742f3 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -95,7 +95,7 @@ void GrContext::initCommon(const GrContextOptions& options) { dtOptions.fClipBatchToBounds = options.fClipBatchToBounds; dtOptions.fDrawBatchBounds = options.fDrawBatchBounds; dtOptions.fMaxBatchLookback = options.fMaxBatchLookback; - fDrawingManager.reset(new GrDrawingManager(this, dtOptions, &fSingleOwner)); + fDrawingManager.reset(new GrDrawingManager(this, dtOptions)); // GrBatchFontCache will eventually replace GrFontCache fBatchFontCache = new GrBatchFontCache(this); diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index 01bd161b30..fcdb1b4078 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -28,7 +28,7 @@ #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingManager->getContext()) #define ASSERT_SINGLE_OWNER \ - SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) + SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(&fSingleOwner);) #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return false; } #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return nullptr; } @@ -50,14 +50,12 @@ private: // when the drawContext attempts to use it (via getDrawTarget). GrDrawContext::GrDrawContext(GrDrawingManager* drawingMgr, GrRenderTarget* rt, - const SkSurfaceProps* surfaceProps, - GrSingleOwner* singleOwner) + const SkSurfaceProps* surfaceProps) : fDrawingManager(drawingMgr) , fRenderTarget(rt) , fDrawTarget(SkSafeRef(rt->getLastDrawTarget())) , fTextContext(nullptr) - , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) - , fSingleOwner(singleOwner) { + , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) { SkDEBUGCODE(this->validate();) } diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index 266aa478ed..2a27f6aac4 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -202,5 +202,5 @@ GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, return nullptr; } - return new GrDrawContext(this, rt, surfaceProps, fSingleOwner); + return new GrDrawContext(this, rt, surfaceProps); } diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h index df6c71a322..c72dad976b 100644 --- a/src/gpu/GrDrawingManager.h +++ b/src/gpu/GrDrawingManager.h @@ -16,7 +16,6 @@ class GrContext; class GrDrawContext; -class GrSingleOWner; class GrSoftwarePathRenderer; class GrTextContext; @@ -54,11 +53,9 @@ public: static bool ProgramUnitTest(GrContext* context, int maxStages); private: - GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets, - GrSingleOwner* singleOwner) + GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets) : fContext(context) , fOptionsForDrawTargets(optionsForDrawTargets) - , fSingleOwner(singleOwner) , fAbandoned(false) , fNVPRTextContext(nullptr) , fPathRendererChain(nullptr) @@ -81,9 +78,6 @@ private: GrContext* fContext; GrDrawTarget::Options fOptionsForDrawTargets; - // In debug builds we guard against improper thread handling - GrSingleOwner* fSingleOwner; - bool fAbandoned; SkTDArray fDrawTargets; -- cgit v1.2.3