Rename GrContext::uniqueID to contextID and hide it
The GrContext's ID isn't really unique any more (since it can be shared among a family of contexts). Change its name to reflect the new reality. Additionally, no client seems to be using it so make it private. Change-Id: Ibb9004d699fe6ca7876b3be94142e612b5b9efbd Reviewed-on: https://skia-review.googlesource.com/c/188308 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
e6e72bcbfa
commit
fd0d97092b
@ -14,6 +14,7 @@
|
||||
class GrBackendFormat;
|
||||
class GrCaps;
|
||||
class GrContext;
|
||||
class GrContext_Base;
|
||||
class GrContextThreadSafeProxyPriv;
|
||||
class GrSkSLFPFactoryCache;
|
||||
struct SkImageInfo;
|
||||
@ -27,7 +28,7 @@ class SK_API GrContextThreadSafeProxy : public SkRefCnt {
|
||||
public:
|
||||
~GrContextThreadSafeProxy() override;
|
||||
|
||||
bool matches(GrContext* context) const;
|
||||
bool matches(GrContext_Base* context) const;
|
||||
|
||||
/**
|
||||
* Create a surface characterization for a DDL that will be replayed into the GrContext
|
||||
@ -68,7 +69,7 @@ public:
|
||||
|
||||
bool operator==(const GrContextThreadSafeProxy& that) const {
|
||||
// Each GrContext should only ever have a single thread-safe proxy.
|
||||
SkASSERT((this == &that) == (fContextUniqueID == that.fContextUniqueID));
|
||||
SkASSERT((this == &that) == (fContextID == that.fContextID));
|
||||
return this == &that;
|
||||
}
|
||||
|
||||
@ -87,8 +88,8 @@ private:
|
||||
sk_sp<GrSkSLFPFactoryCache> cache);
|
||||
|
||||
sk_sp<const GrCaps> fCaps;
|
||||
const uint32_t fContextUniqueID;
|
||||
const GrBackendApi fBackend;
|
||||
const uint32_t fContextID;
|
||||
const GrBackendApi fBackend;
|
||||
const GrContextOptions fOptions;
|
||||
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
|
||||
|
||||
|
@ -25,15 +25,6 @@ public:
|
||||
*/
|
||||
GrBackendApi backend() const { return fBackend; }
|
||||
|
||||
/**
|
||||
* An identifier for this context. The id is used by all compatible contexts. For example,
|
||||
* if SkImages are created on one thread using an image creation context, then fed into a
|
||||
* DDL Recorder on second thread (which has a recording context) and finally replayed on
|
||||
* a third thread with a direct context, then all three contexts will report the same id.
|
||||
* It is an error for an image to be used with contexts that report different ids.
|
||||
*/
|
||||
uint32_t uniqueID() const { return fUniqueID; }
|
||||
|
||||
// Provides access to functions that aren't part of the public API.
|
||||
GrBaseContextPriv priv();
|
||||
const GrBaseContextPriv priv() const;
|
||||
@ -43,6 +34,15 @@ protected:
|
||||
|
||||
GrContext_Base(GrBackendApi backend, uint32_t uniqueID);
|
||||
|
||||
/**
|
||||
* An identifier for this context. The id is used by all compatible contexts. For example,
|
||||
* if SkImages are created on one thread using an image creation context, then fed into a
|
||||
* DDL Recorder on second thread (which has a recording context) and finally replayed on
|
||||
* a third thread with a direct context, then all three contexts will report the same id.
|
||||
* It is an error for an image to be used with contexts that report different ids.
|
||||
*/
|
||||
uint32_t contextID() const { return fContextID; }
|
||||
|
||||
GrContext_Base* asBaseContext() { return this; }
|
||||
virtual GrImageContext* asImageContext() { return nullptr; }
|
||||
virtual GrRecordingContext* asRecordingContext() { return nullptr; }
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
|
||||
private:
|
||||
const GrBackendApi fBackend;
|
||||
const uint32_t fUniqueID;
|
||||
const uint32_t fContextID;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
@ -192,7 +192,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(GrContext* context,
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
if (sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef()) {
|
||||
if (as_IB(image)->contextID() != context->uniqueID()) {
|
||||
if (as_IB(image)->contextID() != context->contextPriv().contextID()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,8 @@ GrBackendTextureImageGenerator::Make(sk_sp<GrTexture> texture, GrSurfaceOrigin o
|
||||
SkImageInfo info = SkImageInfo::Make(texture->width(), texture->height(), colorType, alphaType,
|
||||
std::move(colorSpace));
|
||||
return std::unique_ptr<SkImageGenerator>(new GrBackendTextureImageGenerator(
|
||||
info, texture.get(), origin, context->uniqueID(), std::move(semaphore), backendTexture));
|
||||
info, texture.get(), origin, context->contextPriv().contextID(),
|
||||
std::move(semaphore), backendTexture));
|
||||
}
|
||||
|
||||
GrBackendTextureImageGenerator::GrBackendTextureImageGenerator(const SkImageInfo& info,
|
||||
@ -104,7 +105,7 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
|
||||
fBorrowingMutex.acquire();
|
||||
sk_sp<GrReleaseProcHelper> releaseProcHelper;
|
||||
if (SK_InvalidGenID != fRefHelper->fBorrowingContextID) {
|
||||
if (fRefHelper->fBorrowingContextID != context->uniqueID()) {
|
||||
if (fRefHelper->fBorrowingContextID != context->contextPriv().contextID()) {
|
||||
fBorrowingMutex.release();
|
||||
return nullptr;
|
||||
} else {
|
||||
@ -121,10 +122,10 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
|
||||
fRefHelper));
|
||||
fRefHelper->fBorrowingContextReleaseProc = releaseProcHelper.get();
|
||||
}
|
||||
fRefHelper->fBorrowingContextID = context->uniqueID();
|
||||
fRefHelper->fBorrowingContextID = context->contextPriv().contextID();
|
||||
fBorrowingMutex.release();
|
||||
|
||||
SkASSERT(fRefHelper->fBorrowingContextID == context->uniqueID());
|
||||
SkASSERT(fRefHelper->fBorrowingContextID == context->contextPriv().contextID());
|
||||
|
||||
GrSurfaceDesc desc;
|
||||
desc.fWidth = fBackendTexture.width();
|
||||
|
@ -16,6 +16,7 @@
|
||||
class GrBaseContextPriv {
|
||||
public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
private:
|
||||
explicit GrBaseContextPriv(GrContext_Base* context) : fContext(context) {}
|
||||
|
@ -74,13 +74,13 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
|
||||
if (fGpu) {
|
||||
fCaps = fGpu->refCaps();
|
||||
fResourceCache = new GrResourceCache(fCaps.get(), &fSingleOwner, this->uniqueID());
|
||||
fResourceCache = new GrResourceCache(fCaps.get(), &fSingleOwner, this->contextID());
|
||||
fResourceProvider = new GrResourceProvider(fGpu.get(), fResourceCache, &fSingleOwner,
|
||||
options.fExplicitlyAllocateGPUResources);
|
||||
fProxyProvider =
|
||||
new GrProxyProvider(fResourceProvider, fResourceCache, fCaps, &fSingleOwner);
|
||||
} else {
|
||||
fProxyProvider = new GrProxyProvider(this->uniqueID(), fCaps, &fSingleOwner);
|
||||
fProxyProvider = new GrProxyProvider(this->contextID(), fCaps, &fSingleOwner);
|
||||
}
|
||||
|
||||
if (fResourceCache) {
|
||||
@ -131,8 +131,7 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
|
||||
fGlyphCache = new GrStrikeCache(fCaps.get(), options.fGlyphCacheTextureMaximumBytes);
|
||||
|
||||
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB,
|
||||
this, this->uniqueID()));
|
||||
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this, this->contextID()));
|
||||
|
||||
// DDL TODO: we need to think through how the task group & persistent cache
|
||||
// get passed on to/shared between all the DDLRecorders created with this context.
|
||||
|
@ -30,6 +30,7 @@ class GrContextPriv {
|
||||
public:
|
||||
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
|
@ -8,26 +8,27 @@
|
||||
#include "GrContextThreadSafeProxy.h"
|
||||
#include "GrContextThreadSafeProxyPriv.h"
|
||||
|
||||
#include "GrBaseContextPriv.h"
|
||||
#include "GrCaps.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrSkSLFPFactoryCache.h"
|
||||
#include "SkSurface_Gpu.h"
|
||||
#include "SkSurfaceCharacterization.h"
|
||||
|
||||
GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID,
|
||||
GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t contextID,
|
||||
GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
sk_sp<GrSkSLFPFactoryCache> cache)
|
||||
: fCaps(std::move(caps))
|
||||
, fContextUniqueID(uniqueID)
|
||||
, fContextID(contextID)
|
||||
, fBackend(backend)
|
||||
, fOptions(options)
|
||||
, fFPFactoryCache(std::move(cache)) {}
|
||||
|
||||
GrContextThreadSafeProxy::~GrContextThreadSafeProxy() = default;
|
||||
|
||||
bool GrContextThreadSafeProxy::matches(GrContext* context) const {
|
||||
return context->uniqueID() == fContextUniqueID;
|
||||
bool GrContextThreadSafeProxy::matches(GrContext_Base* context) const {
|
||||
return context->priv().contextID() == fContextID;
|
||||
}
|
||||
|
||||
SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
const GrCaps* caps() const { return fProxy->fCaps.get(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fProxy->fCaps; }
|
||||
uint32_t contextUniqueID() const { return fProxy->fContextUniqueID; }
|
||||
uint32_t contextID() const { return fProxy->fContextID; }
|
||||
GrBackendApi backend() const { return fProxy->fBackend; }
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache() const;
|
||||
|
||||
|
@ -17,9 +17,9 @@ static int32_t next_id() {
|
||||
}
|
||||
|
||||
GrContext_Base::GrContext_Base(GrBackendApi backend,
|
||||
uint32_t uniqueID)
|
||||
uint32_t contextID)
|
||||
: fBackend(backend)
|
||||
, fUniqueID(SK_InvalidGenID == uniqueID ? next_id() : uniqueID) {
|
||||
, fContextID(SK_InvalidGenID == contextID ? next_id() : contextID) {
|
||||
}
|
||||
|
||||
GrContext_Base::~GrContext_Base() {
|
||||
|
@ -18,7 +18,7 @@
|
||||
class SK_API GrDDLContext : public GrContext {
|
||||
public:
|
||||
GrDDLContext(sk_sp<GrContextThreadSafeProxy> proxy)
|
||||
: INHERITED(proxy->priv().backend(), proxy->priv().contextUniqueID()) {
|
||||
: INHERITED(proxy->priv().backend(), proxy->priv().contextID()) {
|
||||
fCaps = proxy->priv().refCaps();
|
||||
fFPFactoryCache = proxy->priv().fpFactoryCache();
|
||||
SkASSERT(fFPFactoryCache);
|
||||
|
@ -63,7 +63,7 @@ protected:
|
||||
SkASSERT(!fThreadSafeProxy);
|
||||
SkASSERT(!fFPFactoryCache);
|
||||
fFPFactoryCache.reset(new GrSkSLFPFactoryCache());
|
||||
fThreadSafeProxy.reset(new GrContextThreadSafeProxy(fCaps, this->uniqueID(),
|
||||
fThreadSafeProxy.reset(new GrContextThreadSafeProxy(fCaps, this->contextID(),
|
||||
this->backend(),
|
||||
options, fFPFactoryCache));
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
class GrImageContextPriv {
|
||||
public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
|
@ -94,8 +94,8 @@ sk_sp<const GrBuffer> GrOnFlushResourceProvider::findOrMakeStaticBuffer(GrBuffer
|
||||
return buffer;
|
||||
}
|
||||
|
||||
uint32_t GrOnFlushResourceProvider::contextUniqueID() const {
|
||||
return fDrawingMgr->getContext()->uniqueID();
|
||||
uint32_t GrOnFlushResourceProvider::contextID() const {
|
||||
return fDrawingMgr->getContext()->contextPriv().contextID();
|
||||
}
|
||||
|
||||
const GrCaps* GrOnFlushResourceProvider::caps() const {
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
sk_sp<const GrBuffer> findOrMakeStaticBuffer(GrBufferType, size_t, const void* data,
|
||||
const GrUniqueKey&);
|
||||
|
||||
uint32_t contextUniqueID() const;
|
||||
uint32_t contextID() const;
|
||||
const GrCaps* caps() const;
|
||||
|
||||
private:
|
||||
|
@ -41,7 +41,7 @@ GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
|
||||
using AllowCaching = GrCoverageCountingPathRenderer::AllowCaching;
|
||||
if (auto ccpr = GrCoverageCountingPathRenderer::CreateIfSupported(
|
||||
caps, AllowCaching(options.fAllowPathMaskCaching),
|
||||
context->uniqueID())) {
|
||||
context->contextPriv().contextID())) {
|
||||
fCoverageCountingPathRenderer = ccpr.get();
|
||||
context->contextPriv().addOnFlushCallbackObject(fCoverageCountingPathRenderer);
|
||||
fChain.push_back(std::move(ccpr));
|
||||
|
@ -16,6 +16,7 @@
|
||||
class GrRecordingContextPriv {
|
||||
public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
|
@ -374,7 +374,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
|
||||
fProxyProvider->assignUniqueKeyToProxy(maskKey, proxy.get());
|
||||
args.fShape->addGenIDChangeListener(
|
||||
sk_make_sp<PathInvalidator>(maskKey, args.fContext->uniqueID()));
|
||||
sk_make_sp<PathInvalidator>(maskKey, args.fContext->contextPriv().contextID()));
|
||||
}
|
||||
}
|
||||
if (inverseFilled) {
|
||||
|
@ -960,8 +960,8 @@ GR_DRAW_OP_TEST_DEFINE(SmallPathOp) {
|
||||
using PathTestStruct = GrSmallPathRenderer::PathTestStruct;
|
||||
static PathTestStruct gTestStruct;
|
||||
|
||||
if (context->uniqueID() != gTestStruct.fContextID) {
|
||||
gTestStruct.fContextID = context->uniqueID();
|
||||
if (context->contextPriv().contextID() != gTestStruct.fContextID) {
|
||||
gTestStruct.fContextID = context->contextPriv().contextID();
|
||||
gTestStruct.reset();
|
||||
const GrBackendFormat format =
|
||||
context->contextPriv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "GrCaps.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrContextPriv.h"
|
||||
#include "GrRecordingContextPriv.h"
|
||||
#include "GrSDFMaskFilter.h"
|
||||
#include "GrTextBlobCache.h"
|
||||
#include "SkDistanceFieldGen.h"
|
||||
@ -210,8 +210,8 @@ GR_DRAW_OP_TEST_DEFINE(GrAtlasTextOp) {
|
||||
static std::unique_ptr<GrTextContext> gTextContext;
|
||||
static SkSurfaceProps gSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||
|
||||
if (context->uniqueID() != gContextID) {
|
||||
gContextID = context->uniqueID();
|
||||
if (context->priv().contextID() != gContextID) {
|
||||
gContextID = context->priv().contextID();
|
||||
gTextContext = GrTextContext::Make(GrTextContext::Options());
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
int srcX, int srcY, CachingHint) const = 0;
|
||||
|
||||
virtual GrContext* context() const { return nullptr; }
|
||||
// TODO: remove this contextID and use GrContext_Base::matches
|
||||
virtual uint32_t contextID() const { return 0; }
|
||||
#if SK_SUPPORT_GPU
|
||||
virtual GrTextureProxy* peekProxy() const { return nullptr; }
|
||||
|
@ -351,7 +351,7 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrContext* context, SkColorSpace* dstCo
|
||||
return nullptr;
|
||||
}
|
||||
if (uint32_t incumbentID = as_IB(this)->contextID()) {
|
||||
if (incumbentID != context->uniqueID()) {
|
||||
if (incumbentID != context->contextPriv().contextID()) {
|
||||
return nullptr;
|
||||
}
|
||||
sk_sp<GrTextureProxy> proxy = as_IB(this)->asTextureProxyRef();
|
||||
|
@ -31,6 +31,13 @@ SkImage_GpuBase::~SkImage_GpuBase() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
void SkImage_GpuBase::resetContext(sk_sp<GrContext> newContext) {
|
||||
SkASSERT(fContext->contextPriv().contextID() == newContext->contextPriv().contextID());
|
||||
fContext = newContext;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool SkImage_GpuBase::ValidateBackendTexture(GrContext* ctx, const GrBackendTexture& tex,
|
||||
GrPixelConfig* config, SkColorType ct, SkAlphaType at,
|
||||
sk_sp<SkColorSpace> cs) {
|
||||
@ -53,6 +60,10 @@ bool SkImage_GpuBase::ValidateBackendTexture(GrContext* ctx, const GrBackendText
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint32_t SkImage_GpuBase::contextID() const {
|
||||
return fContext->contextPriv().contextID();
|
||||
}
|
||||
|
||||
bool SkImage_GpuBase::getROPixels(SkBitmap* dst, CachingHint chint) const {
|
||||
if (!fContext->contextPriv().resourceProvider()) {
|
||||
// DDL TODO: buffer up the readback so it occurs when the DDL is drawn?
|
||||
@ -200,7 +211,7 @@ bool SkImage_GpuBase::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels,
|
||||
sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
|
||||
const GrSamplerState& params,
|
||||
SkScalar scaleAdjust[2]) const {
|
||||
if (context->uniqueID() != fContext->uniqueID()) {
|
||||
if (context->contextPriv().contextID() != fContext->contextPriv().contextID()) {
|
||||
SkASSERT(0);
|
||||
return nullptr;
|
||||
}
|
||||
@ -498,8 +509,8 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
|
||||
}
|
||||
tex->resourcePriv().setUniqueKey(fLastFulfilledKey);
|
||||
SkASSERT(fContextID == SK_InvalidUniqueID ||
|
||||
fContextID == tex->getContext()->uniqueID());
|
||||
fContextID = tex->getContext()->uniqueID();
|
||||
fContextID == tex->getContext()->contextPriv().contextID());
|
||||
fContextID = tex->getContext()->contextPriv().contextID();
|
||||
promiseTexture->addKeyToInvalidate(fContextID, fLastFulfilledKey);
|
||||
return std::move(tex);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
~SkImage_GpuBase() override;
|
||||
|
||||
GrContext* context() const final { return fContext.get(); }
|
||||
uint32_t contextID() const final { return fContext->uniqueID(); }
|
||||
uint32_t contextID() const final;
|
||||
|
||||
bool getROPixels(SkBitmap*, CachingHint) const final;
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect& subset) const final;
|
||||
@ -53,10 +53,7 @@ public:
|
||||
bool onIsValid(GrContext*) const final;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
void resetContext(sk_sp<GrContext> newContext) {
|
||||
SkASSERT(fContext->uniqueID() == newContext->uniqueID());
|
||||
fContext = newContext;
|
||||
}
|
||||
void resetContext(sk_sp<GrContext> newContext);
|
||||
#endif
|
||||
|
||||
static bool ValidateBackendTexture(GrContext* ctx, const GrBackendTexture& tex,
|
||||
|
@ -417,7 +417,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(
|
||||
set_key_on_proxy(proxyProvider, proxy.get(), nullptr, key);
|
||||
if (!willBeMipped || GrMipMapped::kYes == proxy->mipMapped()) {
|
||||
*fUniqueKeyInvalidatedMessages.append() =
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->uniqueID());
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->contextPriv().contextID());
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
@ -450,7 +450,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(
|
||||
kLockTexturePathCount);
|
||||
set_key_on_proxy(proxyProvider, proxy.get(), nullptr, key);
|
||||
*fUniqueKeyInvalidatedMessages.append() =
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->uniqueID());
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->contextPriv().contextID());
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
@ -469,7 +469,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(
|
||||
kLockTexturePathCount);
|
||||
set_key_on_proxy(proxyProvider, proxy.get(), nullptr, key);
|
||||
*fUniqueKeyInvalidatedMessages.append() =
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->uniqueID());
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->contextPriv().contextID());
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
@ -482,7 +482,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(
|
||||
SkASSERT(willBeMipped);
|
||||
SkASSERT(GrMipMapped::kNo == proxy->mipMapped());
|
||||
*fUniqueKeyInvalidatedMessages.append() =
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->uniqueID());
|
||||
new GrUniqueKeyInvalidatedMessage(key, ctx->contextPriv().contextID());
|
||||
if (auto mippedProxy = GrCopyBaseMipMapToTextureProxy(ctx, proxy.get())) {
|
||||
set_key_on_proxy(proxyProvider, mippedProxy.get(), proxy.get(), key);
|
||||
return mippedProxy;
|
||||
|
@ -1045,8 +1045,8 @@ static void test_purge_invalidated(skiatest::Reporter* reporter) {
|
||||
typedef SkMessageBus<GrUniqueKeyInvalidatedMessage> Bus;
|
||||
|
||||
// Invalidate two of the three, they should be purged and no longer accessible via their keys.
|
||||
Bus::Post(Msg(key1, context->uniqueID()));
|
||||
Bus::Post(Msg(key2, context->uniqueID()));
|
||||
Bus::Post(Msg(key1, context->contextPriv().contextID()));
|
||||
Bus::Post(Msg(key2, context->contextPriv().contextID()));
|
||||
cache->purgeAsNeeded();
|
||||
// a should be deleted now, but we still have a ref on b.
|
||||
REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1));
|
||||
@ -1055,7 +1055,7 @@ static void test_purge_invalidated(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, cache->hasUniqueKey(key3));
|
||||
|
||||
// Invalidate the third.
|
||||
Bus::Post(Msg(key3, context->uniqueID()));
|
||||
Bus::Post(Msg(key3, context->contextPriv().contextID()));
|
||||
cache->purgeAsNeeded();
|
||||
// we still have a ref on b, c should be recycled as scratch.
|
||||
REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
|
||||
@ -1571,13 +1571,13 @@ static void test_free_resource_messages(skiatest::Reporter* reporter) {
|
||||
cache->purgeAsNeeded();
|
||||
|
||||
// Send message to free the first resource
|
||||
GrGpuResourceFreedMessage msg1{wrapped1, context->uniqueID()};
|
||||
GrGpuResourceFreedMessage msg1{wrapped1, context->contextPriv().contextID()};
|
||||
SkMessageBus<GrGpuResourceFreedMessage>::Post(msg1);
|
||||
cache->purgeAsNeeded();
|
||||
|
||||
REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
|
||||
|
||||
GrGpuResourceFreedMessage msg2{wrapped3, context->uniqueID()};
|
||||
GrGpuResourceFreedMessage msg2{wrapped3, context->contextPriv().contextID()};
|
||||
SkMessageBus<GrGpuResourceFreedMessage>::Post(msg2);
|
||||
cache->purgeAsNeeded();
|
||||
|
||||
|
@ -203,7 +203,7 @@ static void basic_test(GrContext* context,
|
||||
|
||||
if (expectResourceToOutliveProxy) {
|
||||
proxy.reset();
|
||||
GrUniqueKeyInvalidatedMessage msg(texKey, context->uniqueID());
|
||||
GrUniqueKeyInvalidatedMessage msg(texKey, context->contextPriv().contextID());
|
||||
SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(msg);
|
||||
cache->purgeAsNeeded();
|
||||
expectedCacheCount--;
|
||||
@ -278,7 +278,7 @@ static void invalidation_and_instantiation_test(GrContext* context, skiatest::Re
|
||||
|
||||
// Send an invalidation message, which will be sitting in the cache's inbox
|
||||
SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(
|
||||
GrUniqueKeyInvalidatedMessage(key, context->uniqueID()));
|
||||
GrUniqueKeyInvalidatedMessage(key, context->contextPriv().contextID()));
|
||||
|
||||
REPORTER_ASSERT(reporter, 1 == proxyProvider->numUniqueKeyProxies_TestOnly());
|
||||
REPORTER_ASSERT(reporter, 0 == cache->getResourceCount());
|
||||
|
Loading…
Reference in New Issue
Block a user