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;
// 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;

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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();)
}

View File

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

View File

@ -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<GrDrawTarget*> fDrawTargets;