| Index: src/gpu/GrGpu.h
|
| diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
|
| index 360e889a1d219156e7d47284d1225fb081a7767f..b752f7c09cac2a9fda262f360fc057bb9dcf2907 100644
|
| --- a/src/gpu/GrGpu.h
|
| +++ b/src/gpu/GrGpu.h
|
| @@ -53,12 +53,6 @@
|
|
|
| GrContext* getContext() { return this->INHERITED::getContext(); }
|
| const GrContext* getContext() const { return this->INHERITED::getContext(); }
|
| -
|
| - // Called by GrContext when the underlying backend context has been destroyed.
|
| - // GrGpu should use this to ensure that no backend API calls will be made from
|
| - // here onward, including in its destructor. Subclasses should call
|
| - // INHERITED::contextAbandonded() if they override this.
|
| - virtual void contextAbandonded();
|
|
|
| /**
|
| * The GrGpu object normally assumes that no outsider is setting state
|
| @@ -254,6 +248,30 @@
|
| GrPixelConfig config, const void* buffer,
|
| size_t rowBytes);
|
|
|
| + /**
|
| + * Called to tell GrGpu that all GrGpuResources have been lost and should
|
| + * be abandoned. Overrides must call INHERITED::abandonResources().
|
| + */
|
| + virtual void abandonResources();
|
| +
|
| + /**
|
| + * Called to tell GrGpu to release all GrGpuResources. Overrides must call
|
| + * INHERITED::releaseResources().
|
| + */
|
| + void releaseResources();
|
| +
|
| + /**
|
| + * Add object to list of objects. Should only be called by GrGpuResource.
|
| + * @param resource the resource to add.
|
| + */
|
| + void insertObject(GrGpuResource* object);
|
| +
|
| + /**
|
| + * Remove object from list of objects. Should only be called by GrGpuResource.
|
| + * @param resource the resource to remove.
|
| + */
|
| + void removeObject(GrGpuResource* object);
|
| +
|
| // GrDrawTarget overrides
|
| virtual void clear(const SkIRect* rect,
|
| GrColor color,
|
| @@ -263,7 +281,7 @@
|
| virtual void purgeResources() SK_OVERRIDE {
|
| // The clip mask manager can rebuild all its clip masks so just
|
| // get rid of them all.
|
| - fClipMaskManager.purgeResources();
|
| + fClipMaskManager.releaseResources();
|
| }
|
|
|
| // After the client interacts directly with the 3D context state the GrGpu
|
| @@ -508,6 +526,7 @@
|
| enum {
|
| kPreallocGeomPoolStateStackCnt = 4,
|
| };
|
| + typedef SkTInternalLList<GrGpuResource> ObjectList;
|
| SkSTArray<kPreallocGeomPoolStateStackCnt, GeometryPoolState, true> fGeomPoolStateStack;
|
| ResetTimestamp fResetTimestamp;
|
| uint32_t fResetBits;
|
| @@ -518,6 +537,9 @@
|
| int fIndexPoolUseCnt;
|
| // these are mutable so they can be created on-demand
|
| mutable GrIndexBuffer* fQuadIndexBuffer;
|
| + // Used to abandon/release all resources created by this GrGpu. TODO: Move this
|
| + // functionality to GrResourceCache.
|
| + ObjectList fObjectList;
|
|
|
| typedef GrDrawTarget INHERITED;
|
| };
|
|
|