Destroy resolved framebuffers on resize, not swap.

This fixes a regression introduced by http://codereview.chromium.org/7795015

BUG=95611
TEST=viewport-unchanged-upon-resize.html, read-pixels-test.html


Review URL: http://codereview.chromium.org/7841047

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100277 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 d6e8cfd..a92cb6e 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2525,6 +2525,15 @@
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
     RestoreClearState();
   }
+
+  // Destroy the offscreen resolved framebuffers.
+  if (offscreen_resolved_frame_buffer_.get())
+    offscreen_resolved_frame_buffer_->Destroy();
+  if (offscreen_resolved_color_texture_.get())
+    offscreen_resolved_color_texture_->Destroy();
+  offscreen_resolved_color_texture_.reset();
+  offscreen_resolved_frame_buffer_.reset();
+
   return true;
 }
 
@@ -6545,14 +6554,6 @@
         return error::kLostContext;
       }
 
-      // Destroy the offscreen resolved framebuffers.
-      if (offscreen_resolved_frame_buffer_.get())
-        offscreen_resolved_frame_buffer_->Destroy();
-      if (offscreen_resolved_color_texture_.get())
-        offscreen_resolved_color_texture_->Destroy();
-      offscreen_resolved_color_texture_.reset();
-      offscreen_resolved_frame_buffer_.reset();
-
       // Clear the offscreen color texture.
       // TODO(piman): Is this still necessary?
       {