mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 705904 - [3/6] - Kill nsRefPtrHashtables of WebGL objects, allow unreferenced objects to be freed, fix about:memory reporting of deleted objects - r=jgilbert
This patch takes care of WebGLProgram.
This commit is contained in:
parent
3d33a7e477
commit
39c4a77eb0
@ -236,7 +236,6 @@ WebGLContext::WebGLContext()
|
||||
|
||||
mShaderValidation = true;
|
||||
|
||||
mMapPrograms.Init();
|
||||
mMapShaders.Init();
|
||||
mMapFramebuffers.Init();
|
||||
mMapRenderbuffers.Init();
|
||||
@ -353,7 +352,8 @@ WebGLContext::DestroyResourcesAndContext()
|
||||
DeleteWebGLObjectsHashTable(mMapRenderbuffers);
|
||||
DeleteWebGLObjectsHashTable(mMapFramebuffers);
|
||||
DeleteWebGLObjectsHashTable(mMapShaders);
|
||||
DeleteWebGLObjectsHashTable(mMapPrograms);
|
||||
while (mPrograms.Length())
|
||||
mPrograms.Last()->DeleteOnce();
|
||||
|
||||
if (mBlackTexturesAreInitialized) {
|
||||
gl->fDeleteTextures(1, &mBlackTexture2D);
|
||||
|
@ -826,7 +826,7 @@ protected:
|
||||
|
||||
WebGLFastArray<WebGLTexture*> mTextures;
|
||||
WebGLFastArray<WebGLBuffer*> mBuffers;
|
||||
nsRefPtrHashtable<nsUint32HashKey, WebGLProgram> mMapPrograms;
|
||||
WebGLFastArray<WebGLProgram*> mPrograms;
|
||||
nsRefPtrHashtable<nsUint32HashKey, WebGLShader> mMapShaders;
|
||||
nsRefPtrHashtable<nsUint32HashKey, WebGLFramebuffer> mMapFramebuffers;
|
||||
nsRefPtrHashtable<nsUint32HashKey, WebGLRenderbuffer> mMapRenderbuffers;
|
||||
@ -1645,6 +1645,7 @@ public:
|
||||
mMapUniformLocations.Init();
|
||||
mContext->MakeContextCurrent();
|
||||
mGLName = mContext->gl->fCreateProgram();
|
||||
mMonotonicHandle = mContext->mPrograms.AppendElement(this);
|
||||
}
|
||||
|
||||
~WebGLProgram() {
|
||||
@ -1656,6 +1657,7 @@ public:
|
||||
mContext->MakeContextCurrent();
|
||||
mContext->gl->fDeleteProgram(mGLName);
|
||||
mMapUniformLocations.EnumerateRead(NotifyUniformLocationOfProgramDeletion, nsnull);
|
||||
mContext->mPrograms.RemoveElement(mMonotonicHandle);
|
||||
}
|
||||
|
||||
void DetachShaders() {
|
||||
@ -1753,6 +1755,7 @@ protected:
|
||||
GLint mUniformCount;
|
||||
GLint mAttribCount;
|
||||
std::vector<bool> mAttribsInUse;
|
||||
WebGLMonotonicHandle mMonotonicHandle;
|
||||
|
||||
private:
|
||||
static PLDHashOperator
|
||||
|
@ -1085,7 +1085,6 @@ WebGLContext::CreateProgram(nsIWebGLProgram **retval)
|
||||
|
||||
WebGLProgram *prog = new WebGLProgram(this);
|
||||
NS_ADDREF(*retval = prog);
|
||||
mMapPrograms.Put(prog->GLName(), prog);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1255,7 +1254,6 @@ WebGLContext::DeleteProgram(nsIWebGLProgram *pobj)
|
||||
return NS_OK;
|
||||
|
||||
prog->RequestDelete();
|
||||
mMapPrograms.Remove(progname);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -525,7 +525,6 @@ WebGLContext::InitAndValidateGL()
|
||||
mBoundFramebuffer = nsnull;
|
||||
mBoundRenderbuffer = nsnull;
|
||||
|
||||
mMapPrograms.Clear();
|
||||
mMapShaders.Clear();
|
||||
mMapFramebuffers.Clear();
|
||||
mMapRenderbuffers.Clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user