Use sk_sp to own GrCaps in GrContext.
Change-Id: I46cd37132ecdf0f93be4509c6a06fb74cb185076 Reviewed-on: https://skia-review.googlesource.com/82625 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
1acd3c7e84
commit
eace8cd22a
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user