зеркало из https://github.com/mozilla/moz-skia.git
Enforce calling of inherited onRelease & onAbandon mthds in GrResource-derived classes
http://codereview.appspot.com/6499077/ git-svn-id: http://skia.googlecode.com/svn/trunk@5405 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
981b33abc6
Коммит
d364554bcf
|
@ -75,8 +75,10 @@ protected:
|
|||
|
||||
GrGpu* getGpu() const { return fGpu; }
|
||||
|
||||
virtual void onRelease() = 0;
|
||||
virtual void onAbandon() = 0;
|
||||
// Derived classes should always call their parent class' onRelease
|
||||
// and onAbandon methods in their overrides.
|
||||
virtual void onRelease() {};
|
||||
virtual void onAbandon() {};
|
||||
|
||||
bool isInCache() const { return NULL != fCacheEntry; }
|
||||
|
||||
|
|
|
@ -112,8 +112,12 @@ void GrRenderTarget::setStencilBuffer(GrStencilBuffer* stencilBuffer) {
|
|||
|
||||
void GrRenderTarget::onRelease() {
|
||||
this->setStencilBuffer(NULL);
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrRenderTarget::onAbandon() {
|
||||
this->setStencilBuffer(NULL);
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
|
|
@ -85,12 +85,16 @@ void GrTexture::releaseRenderTarget() {
|
|||
void GrTexture::onRelease() {
|
||||
GrAssert(!this->isSetFlag((GrTextureFlags) kReturnToCache_FlagBit));
|
||||
this->releaseRenderTarget();
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrTexture::onAbandon() {
|
||||
if (NULL != fRenderTarget) {
|
||||
fRenderTarget->abandon();
|
||||
}
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
||||
void GrTexture::validateDesc() const {
|
||||
|
|
|
@ -31,11 +31,15 @@ void GrGLIndexBuffer::onRelease() {
|
|||
GL_CALL(DeleteBuffers(1, &fBufferID));
|
||||
fBufferID = 0;
|
||||
}
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrGLIndexBuffer::onAbandon() {
|
||||
fBufferID = 0;
|
||||
fLockPtr = NULL;
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
||||
void GrGLIndexBuffer::bind() const {
|
||||
|
|
|
@ -37,8 +37,8 @@ protected:
|
|||
bool dynamic);
|
||||
|
||||
// overrides of GrResource
|
||||
virtual void onAbandon();
|
||||
virtual void onRelease();
|
||||
virtual void onAbandon() SK_OVERRIDE;
|
||||
virtual void onRelease() SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
void bind() const;
|
||||
|
|
|
@ -94,9 +94,13 @@ void GrGLPath::onRelease() {
|
|||
GL_CALL(DeletePaths(fPathID, 1));
|
||||
fPathID = 0;
|
||||
}
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrGLPath::onAbandon() {
|
||||
fPathID = 0;
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,10 +28,14 @@ void GrGLStencilBuffer::onRelease() {
|
|||
GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID));
|
||||
fRenderbufferID = 0;
|
||||
}
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrGLStencilBuffer::onAbandon() {
|
||||
fRenderbufferID = 0;
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,19 +55,21 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu,
|
|||
}
|
||||
|
||||
void GrGLTexture::onRelease() {
|
||||
INHERITED::onRelease();
|
||||
GPUGL->notifyTextureDelete(this);
|
||||
if (NULL != fTexIDObj) {
|
||||
fTexIDObj->unref();
|
||||
fTexIDObj = NULL;
|
||||
}
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrGLTexture::onAbandon() {
|
||||
INHERITED::onAbandon();
|
||||
if (NULL != fTexIDObj) {
|
||||
fTexIDObj->abandon();
|
||||
}
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
||||
intptr_t GrGLTexture::getTextureHandle() const {
|
||||
|
|
|
@ -30,11 +30,15 @@ void GrGLVertexBuffer::onRelease() {
|
|||
GL_CALL(DeleteBuffers(1, &fBufferID));
|
||||
fBufferID = 0;
|
||||
}
|
||||
|
||||
INHERITED::onRelease();
|
||||
}
|
||||
|
||||
void GrGLVertexBuffer::onAbandon() {
|
||||
fBufferID = 0;
|
||||
fLockPtr = NULL;
|
||||
|
||||
INHERITED::onAbandon();
|
||||
}
|
||||
|
||||
void GrGLVertexBuffer::bind() const {
|
||||
|
|
|
@ -34,8 +34,8 @@ protected:
|
|||
bool dynamic);
|
||||
|
||||
// overrides of GrResource
|
||||
virtual void onAbandon();
|
||||
virtual void onRelease();
|
||||
virtual void onAbandon() SK_OVERRIDE;
|
||||
virtual void onRelease() SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
void bind() const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче