Adding functionality for purgin graphics resource handles
This will allow a fix to WebKit for preventing a crash when the graphics context is destroyed before the GrContext BUG=http://code.google.com/p/chromium/issues/detail?id=85309 git-svn-id: http://skia.googlecode.com/svn/trunk@1551 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
5189a4e65e
commit
53a5584bb0
@ -65,6 +65,13 @@ public:
|
||||
*/
|
||||
void contextLost();
|
||||
|
||||
/**
|
||||
* Similar to contextLost, but makes no attempt to reset state.
|
||||
* Use this method when GrContext destruction is pending, but
|
||||
* the graphics context is destroyed first.
|
||||
*/
|
||||
void contextDestroyed();
|
||||
|
||||
/**
|
||||
* Frees gpu created by the context. Can be called to reduce GPU memory
|
||||
* pressure.
|
||||
|
@ -325,7 +325,7 @@ public:
|
||||
* Called to tell Gpu object that all GrResources have been lost and should
|
||||
* be abandoned.
|
||||
*/
|
||||
void abandonResources();
|
||||
virtual void abandonResources();
|
||||
|
||||
/**
|
||||
* Called to tell Gpu object to release all GrResources.
|
||||
|
@ -74,6 +74,11 @@ GrContext::~GrContext() {
|
||||
}
|
||||
|
||||
void GrContext::contextLost() {
|
||||
contextDestroyed();
|
||||
this->setupDrawBuffer();
|
||||
}
|
||||
|
||||
void GrContext::contextDestroyed() {
|
||||
// abandon first to so destructors
|
||||
// don't try to free the resources in the API.
|
||||
fGpu->abandonResources();
|
||||
@ -93,8 +98,6 @@ void GrContext::contextLost() {
|
||||
fTextureCache->removeAll();
|
||||
fFontCache->freeAll();
|
||||
fGpu->markContextDirty();
|
||||
|
||||
this->setupDrawBuffer();
|
||||
}
|
||||
|
||||
void GrContext::resetContext() {
|
||||
@ -1245,8 +1248,10 @@ void GrContext::flushText() {
|
||||
|
||||
void GrContext::flushDrawBuffer() {
|
||||
#if BATCH_RECT_TO_RECT || DEFER_TEXT_RENDERING
|
||||
fDrawBuffer->playback(fGpu);
|
||||
fDrawBuffer->reset();
|
||||
if (fDrawBuffer) {
|
||||
fDrawBuffer->playback(fGpu);
|
||||
fDrawBuffer->reset();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void GrGpuGLShaders::abandonResources(){
|
||||
INHERITED::abandonResources();
|
||||
fProgramCache->abandon();
|
||||
}
|
||||
|
||||
void GrGpuGLShaders::DeleteProgram(GrGLProgram::CachedData* programData) {
|
||||
GR_GL(DeleteShader(programData->fVShaderID));
|
||||
GR_GL(DeleteShader(programData->fFShaderID));
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
virtual void resetContext();
|
||||
|
||||
virtual void abandonResources();
|
||||
|
||||
protected:
|
||||
// overrides from GrGpu
|
||||
virtual bool flushGraphicsState(GrPrimitiveType type);
|
||||
|
Loading…
Reference in New Issue
Block a user