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
This commit is contained in:
joshualitt 2016-01-07 13:22:24 -08:00 committed by Commit bot
parent 9a9515e081
commit 94da292e39
7 changed files with 9 additions and 22 deletions

View File

@ -392,9 +392,7 @@ private:
SkMutex fTestPMConversionsMutex; SkMutex fTestPMConversionsMutex;
// In debug builds we guard against improper thread handling // In debug builds we guard against improper thread handling
// This guard is passed to the GrDrawingManager and, from there to all the SkDEBUGCODE(mutable GrSingleOwner fSingleOwner;)
// GrDrawContexts. It is also passed to the GrTextureProvider and SkGpuDevice.
mutable GrSingleOwner fSingleOwner;
struct CleanUpData { struct CleanUpData {
PFCleanUpFunc fFunc; PFCleanUpFunc fFunc;

View File

@ -283,8 +283,7 @@ private:
SkDEBUGCODE(void validate() const;) SkDEBUGCODE(void validate() const;)
GrDrawContext(GrDrawingManager*, GrRenderTarget*, const SkSurfaceProps* surfaceProps, GrDrawContext(GrDrawingManager*, GrRenderTarget*, const SkSurfaceProps* surfaceProps);
GrSingleOwner*);
void internalDrawPath(GrPipelineBuilder*, void internalDrawPath(GrPipelineBuilder*,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
@ -310,7 +309,7 @@ private:
SkSurfaceProps fSurfaceProps; SkSurfaceProps fSurfaceProps;
// In debug builds we guard against improper thread handling // In debug builds we guard against improper thread handling
mutable GrSingleOwner* fSingleOwner; SkDEBUGCODE(mutable GrSingleOwner fSingleOwner;)
}; };
#endif #endif

View File

@ -48,8 +48,6 @@ private:
SkThreadID fOwner; // guarded by fMutex SkThreadID fOwner; // guarded by fMutex
int fReentranceCount; // guarded by fMutex int fReentranceCount; // guarded by fMutex
}; };
#else
class GrSingleOwner {}; // Provide a dummy implementation so we can pass pointers to constructors
#endif #endif
#endif #endif

View File

@ -95,7 +95,7 @@ void GrContext::initCommon(const GrContextOptions& options) {
dtOptions.fClipBatchToBounds = options.fClipBatchToBounds; dtOptions.fClipBatchToBounds = options.fClipBatchToBounds;
dtOptions.fDrawBatchBounds = options.fDrawBatchBounds; dtOptions.fDrawBatchBounds = options.fDrawBatchBounds;
dtOptions.fMaxBatchLookback = options.fMaxBatchLookback; dtOptions.fMaxBatchLookback = options.fMaxBatchLookback;
fDrawingManager.reset(new GrDrawingManager(this, dtOptions, &fSingleOwner)); fDrawingManager.reset(new GrDrawingManager(this, dtOptions));
// GrBatchFontCache will eventually replace GrFontCache // GrBatchFontCache will eventually replace GrFontCache
fBatchFontCache = new GrBatchFontCache(this); fBatchFontCache = new GrBatchFontCache(this);

View File

@ -28,7 +28,7 @@
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingManager->getContext()) #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingManager->getContext())
#define ASSERT_SINGLE_OWNER \ #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_IF_ABANDONED if (fDrawingManager->abandoned()) { return; }
#define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return false; } #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return false; }
#define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return nullptr; } #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return nullptr; }
@ -50,14 +50,12 @@ private:
// when the drawContext attempts to use it (via getDrawTarget). // when the drawContext attempts to use it (via getDrawTarget).
GrDrawContext::GrDrawContext(GrDrawingManager* drawingMgr, GrDrawContext::GrDrawContext(GrDrawingManager* drawingMgr,
GrRenderTarget* rt, GrRenderTarget* rt,
const SkSurfaceProps* surfaceProps, const SkSurfaceProps* surfaceProps)
GrSingleOwner* singleOwner)
: fDrawingManager(drawingMgr) : fDrawingManager(drawingMgr)
, fRenderTarget(rt) , fRenderTarget(rt)
, fDrawTarget(SkSafeRef(rt->getLastDrawTarget())) , fDrawTarget(SkSafeRef(rt->getLastDrawTarget()))
, fTextContext(nullptr) , fTextContext(nullptr)
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) {
, fSingleOwner(singleOwner) {
SkDEBUGCODE(this->validate();) SkDEBUGCODE(this->validate();)
} }

View File

@ -202,5 +202,5 @@ GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt,
return nullptr; return nullptr;
} }
return new GrDrawContext(this, rt, surfaceProps, fSingleOwner); return new GrDrawContext(this, rt, surfaceProps);
} }

View File

@ -16,7 +16,6 @@
class GrContext; class GrContext;
class GrDrawContext; class GrDrawContext;
class GrSingleOWner;
class GrSoftwarePathRenderer; class GrSoftwarePathRenderer;
class GrTextContext; class GrTextContext;
@ -54,11 +53,9 @@ public:
static bool ProgramUnitTest(GrContext* context, int maxStages); static bool ProgramUnitTest(GrContext* context, int maxStages);
private: private:
GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets, GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets)
GrSingleOwner* singleOwner)
: fContext(context) : fContext(context)
, fOptionsForDrawTargets(optionsForDrawTargets) , fOptionsForDrawTargets(optionsForDrawTargets)
, fSingleOwner(singleOwner)
, fAbandoned(false) , fAbandoned(false)
, fNVPRTextContext(nullptr) , fNVPRTextContext(nullptr)
, fPathRendererChain(nullptr) , fPathRendererChain(nullptr)
@ -81,9 +78,6 @@ private:
GrContext* fContext; GrContext* fContext;
GrDrawTarget::Options fOptionsForDrawTargets; GrDrawTarget::Options fOptionsForDrawTargets;
// In debug builds we guard against improper thread handling
GrSingleOwner* fSingleOwner;
bool fAbandoned; bool fAbandoned;
SkTDArray<GrDrawTarget*> fDrawTargets; SkTDArray<GrDrawTarget*> fDrawTargets;