Refactor GPU code. Framebuffer* info to Framebuffer* framebuffer

BUG=none


Review URL: https://chromiumcodereview.appspot.com/12468010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187149 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 1b6e92f9..9077b6d 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -980,11 +980,8 @@
   }
 
   // Gets the framebuffer info for the given framebuffer.
-  Framebuffer* GetFramebuffer(
-      GLuint client_id) {
-    Framebuffer* info =
-        framebuffer_manager()->GetFramebuffer(client_id);
-    return info;
+  Framebuffer* GetFramebuffer(GLuint client_id) {
+    return framebuffer_manager()->GetFramebuffer(client_id);
   }
 
   // Removes the framebuffer info for the given framebuffer.
@@ -1054,8 +1051,7 @@
 
   // Clears any uncleared attachments attached to the given frame buffer.
   // Returns false if there was a generated GL error.
-  void ClearUnclearedAttachments(
-      GLenum target, Framebuffer* info);
+  void ClearUnclearedAttachments(GLenum target, Framebuffer* framebuffer);
 
   // overridden from GLES2Decoder
   virtual bool ClearLevel(unsigned service_id,
@@ -1463,22 +1459,21 @@
   }
 
   // Gets the framebuffer info for a particular target.
-  Framebuffer* GetFramebufferInfoForTarget(
-      GLenum target) {
-    Framebuffer* info = NULL;
+  Framebuffer* GetFramebufferInfoForTarget(GLenum target) {
+    Framebuffer* framebuffer = NULL;
     switch (target) {
       case GL_FRAMEBUFFER:
       case GL_DRAW_FRAMEBUFFER_EXT:
-        info = state_.bound_draw_framebuffer;
+        framebuffer = state_.bound_draw_framebuffer;
         break;
       case GL_READ_FRAMEBUFFER_EXT:
-        info = state_.bound_read_framebuffer;
+        framebuffer = state_.bound_read_framebuffer;
         break;
       default:
         NOTREACHED();
         break;
     }
-    return info;
+    return framebuffer;
   }
 
   Renderbuffer* GetRenderbufferInfoForTarget(
@@ -2809,9 +2804,9 @@
 
 static void RebindCurrentFramebuffer(
     GLenum target,
-    Framebuffer* info,
+    Framebuffer* framebuffer,
     GLuint back_buffer_service_id) {
-  GLuint framebuffer_id = info ? info->service_id() : 0;
+  GLuint framebuffer_id = framebuffer ? framebuffer->service_id() : 0;
 
   if (framebuffer_id == 0) {
     framebuffer_id = back_buffer_service_id;
@@ -3706,11 +3701,11 @@
 }
 
 void GLES2DecoderImpl::DoBindFramebuffer(GLenum target, GLuint client_id) {
-  Framebuffer* info = NULL;
+  Framebuffer* framebuffer = NULL;
   GLuint service_id = 0;
   if (client_id != 0) {
-    info = GetFramebuffer(client_id);
-    if (!info) {
+    framebuffer = GetFramebuffer(client_id);
+    if (!framebuffer) {
       if (!group_->bind_generates_resource()) {
          LOG(ERROR)
              << "glBindFramebuffer: id not generated by glGenFramebuffers";
@@ -3718,32 +3713,32 @@
          return;
       }
 
-      // It's a new id so make a framebuffer info for it.
+      // It's a new id so make a framebuffer framebuffer for it.
       glGenFramebuffersEXT(1, &service_id);
       CreateFramebuffer(client_id, service_id);
-      info = GetFramebuffer(client_id);
+      framebuffer = GetFramebuffer(client_id);
       IdAllocatorInterface* id_allocator =
           group_->GetIdAllocator(id_namespaces::kFramebuffers);
       id_allocator->MarkAsUsed(client_id);
     } else {
-      service_id = info->service_id();
+      service_id = framebuffer->service_id();
     }
-    info->MarkAsValid();
+    framebuffer->MarkAsValid();
   }
-  LogClientServiceForInfo(info, client_id, "glBindFramebuffer");
+  LogClientServiceForInfo(framebuffer, client_id, "glBindFramebuffer");
 
   if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT) {
-    state_.bound_draw_framebuffer = info;
+    state_.bound_draw_framebuffer = framebuffer;
   }
   if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT) {
-    state_.bound_read_framebuffer = info;
+    state_.bound_read_framebuffer = framebuffer;
   }
 
   clear_state_dirty_ = true;
 
   // If we are rendering to the backbuffer get the FBO id for any simulated
   // backbuffer.
-  if (info == NULL) {
+  if (framebuffer == NULL) {
     service_id = GetBackbufferServiceId();
   }
 
@@ -4651,9 +4646,8 @@
 void GLES2DecoderImpl::DoFramebufferRenderbuffer(
     GLenum target, GLenum attachment, GLenum renderbuffertarget,
     GLuint client_renderbuffer_id) {
-  Framebuffer* framebuffer_info =
-      GetFramebufferInfoForTarget(target);
-  if (!framebuffer_info) {
+  Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
+  if (!framebuffer) {
     SetGLError(GL_INVALID_OPERATION,
                "glFramebufferRenderbuffer", "no framebuffer bound");
     return;
@@ -4674,9 +4668,9 @@
       target, attachment, renderbuffertarget, service_id);
   GLenum error = PeekGLError();
   if (error == GL_NO_ERROR) {
-    framebuffer_info->AttachRenderbuffer(attachment, info);
+    framebuffer->AttachRenderbuffer(attachment, info);
   }
-  if (framebuffer_info == state_.bound_draw_framebuffer) {
+  if (framebuffer == state_.bound_draw_framebuffer) {
     clear_state_dirty_ = true;
   }
 }
@@ -4721,34 +4715,35 @@
 
 // Assumes framebuffer is complete.
 void GLES2DecoderImpl::ClearUnclearedAttachments(
-    GLenum target, Framebuffer* info) {
+    GLenum target, Framebuffer* framebuffer) {
   if (target == GL_READ_FRAMEBUFFER_EXT) {
     // bind this to the DRAW point, clear then bind back to READ
     // TODO(gman): I don't think there is any guarantee that an FBO that
     //   is complete on the READ attachment will be complete as a DRAW
     //   attachment.
     glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
-    glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, info->service_id());
+    glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, framebuffer->service_id());
   }
   GLbitfield clear_bits = 0;
-  if (info->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)) {
+  if (framebuffer->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)) {
     glClearColor(
         0.0f, 0.0f, 0.0f,
         (GLES2Util::GetChannelsForFormat(
-             info->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : 1.0f);
+             framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f :
+                                                                       1.0f);
     glColorMask(true, true, true, true);
     clear_bits |= GL_COLOR_BUFFER_BIT;
   }
 
-  if (info->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
-      info->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
+  if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
+      framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
     glClearStencil(0);
     glStencilMask(-1);
     clear_bits |= GL_STENCIL_BUFFER_BIT;
   }
 
-  if (info->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) ||
-      info->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
+  if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) ||
+      framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
     glClearDepth(1.0f);
     glDepthMask(true);
     clear_bits |= GL_DEPTH_BUFFER_BIT;
@@ -4758,16 +4753,16 @@
   glClear(clear_bits);
 
   framebuffer_manager()->MarkAttachmentsAsCleared(
-      info, renderbuffer_manager(), texture_manager());
+      framebuffer, renderbuffer_manager(), texture_manager());
 
   RestoreClearState();
 
   if (target == GL_READ_FRAMEBUFFER_EXT) {
-    glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, info->service_id());
-    Framebuffer* framebuffer =
+    glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, framebuffer->service_id());
+    Framebuffer* draw_framebuffer =
         GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
-    GLuint service_id =
-        framebuffer ? framebuffer->service_id() : GetBackbufferServiceId();
+    GLuint service_id = draw_framebuffer ? draw_framebuffer->service_id() :
+                                           GetBackbufferServiceId();
     glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, service_id);
   }
 }
@@ -4800,9 +4795,8 @@
 void GLES2DecoderImpl::DoFramebufferTexture2D(
     GLenum target, GLenum attachment, GLenum textarget,
     GLuint client_texture_id, GLint level) {
-  Framebuffer* framebuffer_info =
-      GetFramebufferInfoForTarget(target);
-  if (!framebuffer_info) {
+  Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
+  if (!framebuffer) {
     SetGLError(GL_INVALID_OPERATION,
                "glFramebufferTexture2D", "no framebuffer bound.");
     return;
@@ -4829,18 +4823,17 @@
   glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level);
   GLenum error = PeekGLError();
   if (error == GL_NO_ERROR) {
-    framebuffer_info->AttachTexture(attachment, texture, textarget, level);
+    framebuffer->AttachTexture(attachment, texture, textarget, level);
   }
-  if (framebuffer_info == state_.bound_draw_framebuffer) {
+  if (framebuffer == state_.bound_draw_framebuffer) {
     clear_state_dirty_ = true;
   }
 }
 
 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv(
     GLenum target, GLenum attachment, GLenum pname, GLint* params) {
-  Framebuffer* framebuffer_info =
-      GetFramebufferInfoForTarget(target);
-  if (!framebuffer_info) {
+  Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
+  if (!framebuffer) {
     SetGLError(GL_INVALID_OPERATION,
                "glFramebufferAttachmentParameteriv", "no framebuffer bound");
     return;