Add GrResource base class for ibs, texs, vbs, etc.
Add lostContext() to GrContext.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@1026 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp
index 6833a31..bb71255 100644
--- a/gpu/src/GrGpuGL.cpp
+++ b/gpu/src/GrGpuGL.cpp
@@ -232,7 +232,7 @@
     fMSFBOType = kNone_MSFBO;
     if (GR_GL_SUPPORT_ES) {
        if (has_gl_extension("GL_CHROMIUM_framebuffer_multisample")) {
-           // chrome's extension is equivalent to the EXT msaa 
+           // chrome's extension is equivalent to the EXT msaa
            // and fbo_blit extensions.
             fMSFBOType = kDesktopEXT_MSFBO;
        } else if (has_gl_extension("GL_APPLE_framebuffer_multisample")) {
@@ -552,7 +552,7 @@
     rtIDs.fRTFBOID  = (GrGLuint)platformRenderTarget;
     rtIDs.fTexFBOID = (GrGLuint)platformRenderTarget;
 
-    return new GrGLRenderTarget(rtIDs, NULL, stencilBits, viewport, NULL, this);
+    return new GrGLRenderTarget(this, rtIDs, NULL, stencilBits, viewport, NULL);
 }
 
 GrRenderTarget* GrGpuGL::createRenderTargetFrom3DApiStateHelper() {
@@ -571,7 +571,7 @@
 
     rtIDs.fOwnIDs = false;
 
-    return new GrGLRenderTarget(rtIDs, NULL, stencilBits, viewport, NULL, this);
+    return new GrGLRenderTarget(this, rtIDs, NULL, stencilBits, viewport, NULL);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -833,7 +833,7 @@
         GR_GL(GenFramebuffers(1, &rtIDs.fTexFBOID));
         GrAssert(rtIDs.fTexFBOID);
 
-        // If we are using multisampling and we will create two FBOS We render 
+        // If we are using multisampling and we will create two FBOS We render
         // to one and then resolve to the texture bound to the other.
         if (samples > 1 && kNone_MSFBO != fMSFBOType) {
             GR_GL(GenFramebuffers(1, &rtIDs.fRTFBOID));
@@ -997,7 +997,7 @@
     GrPrintf("--- new texture [%d] size=(%d %d) bpp=%d\n",
              tex->fTextureID, width, height, tex->fUploadByteCount);
 #endif
-    GrGLTexture* tex = new GrGLTexture(glDesc, rtIDs, DEFAULT_PARAMS, this);
+    GrGLTexture* tex = new GrGLTexture(this, glDesc, rtIDs, DEFAULT_PARAMS);
 
     if (0 != rtIDs.fTexFBOID) {
         GrRenderTarget* rt = tex->asRenderTarget();
@@ -1032,7 +1032,7 @@
             fHWGeometryState.fVertexBuffer = NULL;
             return NULL;
         }
-        GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(id, this,
+        GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, id,
                                                               size, dynamic);
         fHWGeometryState.fVertexBuffer = vertexBuffer;
         return vertexBuffer;
@@ -1055,7 +1055,7 @@
             fHWGeometryState.fIndexBuffer = NULL;
             return NULL;
         }
-        GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(id, this,
+        GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, id,
                                                          size, dynamic);
         fHWGeometryState.fIndexBuffer = indexBuffer;
         return indexBuffer;