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

Unified Diff: ui/gfx/compositor/compositor_gl.cc

Issue 7021014: GLContext no longer holds a pointer to a GLSurface. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
Index: ui/gfx/compositor/compositor_gl.cc
===================================================================
--- ui/gfx/compositor/compositor_gl.cc (revision 85357)
+++ ui/gfx/compositor/compositor_gl.cc (working copy)
@@ -30,6 +30,7 @@
virtual void NotifyEnd() OVERRIDE;
// The GL context used for compositing.
+ scoped_ptr<gfx::GLSurface> gl_surface_;
scoped_ptr<gfx::GLContext> gl_context_;
// Keep track of whether compositing has started or not.
@@ -40,9 +41,8 @@
CompositorGL::CompositorGL(gfx::AcceleratedWidget widget)
: started_(false) {
- scoped_ptr<gfx::GLSurface> surface(
- gfx::GLSurface::CreateViewGLSurface(widget));
- gl_context_.reset(gfx::GLContext::CreateGLContext(surface.release(), NULL)),
+ gl_surface_.reset(gfx::GLSurface::CreateViewGLSurface(widget));
+ gl_context_.reset(gfx::GLContext::CreateGLContext(NULL)),
}
Texture* CompositorGL::CreateTexture() {
@@ -51,12 +51,12 @@
void CompositorGL::NotifyStart() {
started_ = true;
- gl_context_->MakeCurrent();
+ gl_context_->MakeCurrent(gl_surface_.get());
}
void CompositorGL::NotifyEnd() {
DCHECK(started_);
- gl_context_->SwapBuffers();
+ gl_surface_->SwapBuffers();
started_ = false;
}
@@ -83,6 +83,7 @@
void RestoreTransform() OVERRIDE;
// The GL context used for compositing.
+ scoped_ptr<gfx::GLSurface> gl_surface_;
scoped_ptr<gfx::GLContext> gl_context_;
// Keep track of whether compositing has started or not.
@@ -93,19 +94,18 @@
CompositorGL::CompositorGL(gfx::AcceleratedWidget widget)
: started_(false) {
- scoped_ptr<gfx::GLSurface> surface(
- gfx::GLSurface::CreateViewGLSurface(widget));
- gl_context_.reset(gfx::GLContext::CreateGLContext(surface.release(), NULL));
+ gl_surface_.reset(gfx::GLSurface::CreateViewGLSurface(widget));
+ gl_context_.reset(gfx::GLContext::CreateGLContext(NULL));
}
void CompositorGL::NotifyStart() {
started_ = true;
- gl_context_->MakeCurrent();
+ gl_context_->MakeCurrent(gl_surface_.get());
}
void CompositorGL::NotifyEnd() {
DCHECK(started_);
- gl_context_->SwapBuffers();
+ gl_surface_->SwapBuffers();
started_ = false;
}

Powered by Google App Engine
This is Rietveld 408576698