Replaced raw pointers to RefCountObject to BindingPointer.

This fixes the ANGLE crashes in Chrome when using canvas 2D.

The issue was this:

Renderbuffer *mColorbufferProxy = new RenderBuffer(...); // Reference count is zero.

BindingPointer<RenderBuffer> tempRef;
tempRef.set(mColorbufferProxy); // Reference count is one.

tempRef.set(NULL); // Reference count is zero and object is destroyed, leaving mColorbufferProxy dangling.

I also initially suspected the problem was that FBOs are not treated as shared and the implementation of shared FBOs is still in the patch. I believe GLES2 supports shared FBOs.

My reading of the GLES2 spec is that when a shared object is deleted, it loses its id but retains its state if left bound elsewhere. I added that to RefCountObject.



Review URL: http://codereview.appspot.com/2120045

git-svn-id: https://angleproject.googlecode.com/svn/trunk@417 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/ResourceManager.h b/src/libGLESv2/ResourceManager.h
index 346e51f..97f82b7 100644
--- a/src/libGLESv2/ResourceManager.h
+++ b/src/libGLESv2/ResourceManager.h
@@ -24,6 +24,7 @@
 class Program;
 class Texture;
 class Renderbuffer;
+class Framebuffer;
 
 enum SamplerType
 {
@@ -47,25 +48,29 @@
     GLuint createProgram();
     GLuint createTexture();
     GLuint createRenderbuffer();
+    GLuint createFramebuffer();
 
     void deleteBuffer(GLuint buffer);
     void deleteShader(GLuint shader);
     void deleteProgram(GLuint program);
     void deleteTexture(GLuint texture);
     void deleteRenderbuffer(GLuint renderbuffer);
+    void deleteFramebuffer(GLuint framebuffer);
 
     Buffer *getBuffer(GLuint handle);
     Shader *getShader(GLuint handle);
     Program *getProgram(GLuint handle);
     Texture *getTexture(GLuint handle);
     Renderbuffer *getRenderbuffer(GLuint handle);
+    Framebuffer *getFramebuffer(GLuint handle);
     
     void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
 
     void checkBufferAllocation(unsigned int buffer);
     void checkTextureAllocation(GLuint texture, SamplerType type);
     void checkRenderbufferAllocation(GLuint renderbuffer);
-
+    void checkFramebufferAllocation(GLuint framebuffer);
+    
   private:
     DISALLOW_COPY_AND_ASSIGN(ResourceManager);
 
@@ -85,6 +90,9 @@
 
     typedef std::map<GLuint, Renderbuffer*> RenderbufferMap;
     RenderbufferMap mRenderbufferMap;
+
+    typedef std::map<GLuint, Framebuffer*> FramebufferMap;
+    FramebufferMap mFramebufferMap;
 };
 
 }