Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 15928002: GPU: Keep track of the last real context and real surface made current. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nix unnecessary changes. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_gl_api_implementation.cc ('k') | ui/gl/gl_surface_osmesa.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 107330447b2d2a0156fae1a65bcd8af9bb0fbf03..84efbc61764e7211326b3814901c33e2e81c3be6 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -16,6 +16,7 @@
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface_stub.h"
+#include "ui/gl/scoped_make_current.h"
#if defined(USE_X11)
extern "C" {
@@ -410,20 +411,23 @@ bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size) {
if (size == GetSize())
return true;
+ scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
GLContext* current_context = GLContext::GetCurrent();
- bool was_current = current_context && current_context->IsCurrent(this);
- if (was_current)
+ bool was_current =
+ current_context && current_context->IsCurrent(this);
+ if (was_current) {
+ scoped_make_current.reset(
+ new ui::ScopedMakeCurrent(current_context, this));
current_context->ReleaseCurrent(this);
+ }
Destroy();
if (!Initialize()) {
- LOG(ERROR) << "Failed to resize pbuffer.";
+ LOG(ERROR) << "Failed to resize window.";
return false;
}
- if (was_current)
- return current_context->MakeCurrent(this);
return true;
}
@@ -554,8 +558,14 @@ bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) {
if (size == size_)
return true;
+ scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
GLContext* current_context = GLContext::GetCurrent();
- bool was_current = current_context && current_context->IsCurrent(this);
+ bool was_current =
+ current_context && current_context->IsCurrent(this);
+ if (was_current) {
+ scoped_make_current.reset(
+ new ui::ScopedMakeCurrent(current_context, this));
+ }
size_ = size;
@@ -564,9 +574,6 @@ bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) {
return false;
}
- if (was_current)
- return current_context->MakeCurrent(this);
-
return true;
}
« no previous file with comments | « ui/gl/gl_gl_api_implementation.cc ('k') | ui/gl/gl_surface_osmesa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698