From 746b28bb78b0f5390ff43f15b82b9145e1adb10c Mon Sep 17 00:00:00 2001
From: "sievers@chromium.org"
 <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 12 Jun 2013 23:42:15 +0000
Subject: Revert 205481 "Virtual context MakeCurrent tweaks."

> Virtual context MakeCurrent tweaks.
>
> Do not allow GLContextVirtual::MakeCurrent() without a decoder (state
> restorer), since this only leads to state bugs.
>
> For this reason remove the necessity of having a current context during surface destruction (it's ugly anyway, since GLSurface is RefCounted).
>
> BUG=248395
>
> Review URL: https://chromiumcodereview.appspot.com/15925007

TBR=sievers@chromium.org

Review URL: https://codereview.chromium.org/16841006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205970 0039d316-1c4b-4281-b951-d872f2087c98
---
 gpu/command_buffer/service/gl_context_virtual.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'gpu/command_buffer/service/gl_context_virtual.cc')

diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc
index e7a4c04..dd32495 100644
--- a/gpu/command_buffer/service/gl_context_virtual.cc
+++ b/gpu/command_buffer/service/gl_context_virtual.cc
@@ -54,11 +54,14 @@ void GLContextVirtual::Destroy() {
 }
 
 bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
+  // TODO(epenner): We should avoid bypassing MakeVirtuallyCurrent() below
+  // (return false or DCHECK when !decoder). To do this we must reorder
+  // tear-down in GpuCommandBufferStub::Destroy().
   if (decoder_.get())
-    return shared_context_->MakeVirtuallyCurrent(this, surface);
-
-  LOG(ERROR) << "Trying to make virtual context current without decoder.";
-  return false;
+    shared_context_->MakeVirtuallyCurrent(this, surface);
+  else if (!IsCurrent(surface))
+    shared_context_->MakeCurrent(surface);
+  return true;
 }
 
 void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) {
-- 
cgit v1.1