diff options
-rw-r--r-- | include/gpu/GrContext.h | 4 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 32bee50297..02b26a8aa5 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -208,7 +208,7 @@ public: void purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources); /** Access the context capabilities */ - const GrCaps* caps() const { return fCaps; } + const GrCaps* caps() const { return fCaps.get(); } /** * Returns the recommended sample count for a render target when using this @@ -348,7 +348,7 @@ public: private: sk_sp<GrGpu> fGpu; - const GrCaps* fCaps; + sk_sp<const GrCaps> fCaps; GrResourceCache* fResourceCache; GrResourceProvider* fResourceProvider; diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index eaacdb1cad..388c9411b1 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -173,7 +173,6 @@ static int32_t next_id() { } GrContext::GrContext() : fUniqueID(next_id()) { - fCaps = nullptr; fResourceCache = nullptr; fResourceProvider = nullptr; fAtlasGlyphCache = nullptr; @@ -195,8 +194,8 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext, bool GrContext::init(const GrContextOptions& options) { ASSERT_SINGLE_OWNER - fCaps = SkRef(fGpu->caps()); - fResourceCache = new GrResourceCache(fCaps, fUniqueID); + fCaps = sk_ref_sp(fGpu->caps()); + fResourceCache = new GrResourceCache(fCaps.get(), fUniqueID); fResourceProvider = new GrResourceProvider(fGpu.get(), fResourceCache, &fSingleOwner); fDisableGpuYUVConversion = options.fDisableGpuYUVConversion; @@ -268,13 +267,11 @@ GrContext::~GrContext() { delete fResourceProvider; delete fResourceCache; delete fAtlasGlyphCache; - - fCaps->unref(); } sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() { if (!fThreadSafeProxy) { - fThreadSafeProxy.reset(new GrContextThreadSafeProxy(sk_ref_sp(fCaps), this->uniqueID())); + fThreadSafeProxy.reset(new GrContextThreadSafeProxy(fCaps, this->uniqueID())); } return fThreadSafeProxy; } |