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

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 86168)
+++ ui/gfx/compositor/compositor_gl.cc (working copy)
@@ -63,6 +63,7 @@
virtual void NotifyEnd() OVERRIDE;
// The GL context used for compositing.
+ scoped_ptr<gfx::GLSurface> gl_surface_;
scoped_ptr<gfx::GLContext> gl_context_;
gfx::Size size_;
@@ -194,9 +195,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, gl_surface.get())),
gl_context_->MakeCurrent();
glColorMask(true, true, true, true);
glEnable(GL_BLEND);
@@ -221,7 +221,7 @@
void CompositorGL::NotifyStart() {
started_ = true;
- gl_context_->MakeCurrent();
+ gl_context_->MakeCurrent(gl_surface_.get());
glViewport(0, 0,
gl_context_->GetSize().width(), gl_context_->GetSize().height());
@@ -235,7 +235,7 @@
void CompositorGL::NotifyEnd() {
DCHECK(started_);
- gl_context_->SwapBuffers();
+ gl_surface_->SwapBuffers();
started_ = false;
}
@@ -272,6 +272,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.
@@ -282,19 +283,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, gl_surface_.get()));
}
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