diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 20:34:15 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 20:34:15 +0000 |
commit | f62a5abd6205c7a84a19f8b00b45b0792b767f57 (patch) | |
tree | 100e751f4e0302bbb4ecde919fb1cea272aeb7cf /content/gpu | |
parent | 97807cbf58afe1e25b2bd014ce758e88e483d08b (diff) | |
download | chromium_src-f62a5abd6205c7a84a19f8b00b45b0792b767f57.zip chromium_src-f62a5abd6205c7a84a19f8b00b45b0792b767f57.tar.gz chromium_src-f62a5abd6205c7a84a19f8b00b45b0792b767f57.tar.bz2 |
GLContext no longer holds a pointer to a GLSurface.
This is part of an ongoing effort to treat GL contexts and GL surfaces as independent entities.
TEST=run WebGL on mac, windows and linux, trybots
BUG=none
Review URL: http://codereview.chromium.org/7021014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/gpu')
-rw-r--r-- | content/gpu/gpu_info_collector.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc index 07a5f1c..80c98fa 100644 --- a/content/gpu/gpu_info_collector.cc +++ b/content/gpu/gpu_info_collector.cc @@ -18,13 +18,7 @@ namespace { -// This creates an offscreen GL context for gl queries. Returned GLContext -// should be deleted in FinalizeGLContext. -gfx::GLContext* InitializeGLContext() { - if (!gfx::GLSurface::InitializeOneOff()) { - LOG(ERROR) << "gfx::GLContext::InitializeOneOff() failed"; - return NULL; - } +gfx::GLSurface* InitializeGLSurface() { scoped_ptr<gfx::GLSurface> surface(gfx::GLSurface::CreateOffscreenGLSurface( gfx::Size(1, 1))); if (!surface.get()) { @@ -32,15 +26,19 @@ gfx::GLContext* InitializeGLContext() { return NULL; } - scoped_ptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext( - surface.release(), - NULL)); + return surface.release(); +} + +gfx::GLContext* InitializeGLContext(gfx::GLSurface* surface) { + + scoped_ptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext(NULL, + surface)); if (!context.get()) { LOG(ERROR) << "gfx::GLContext::CreateGLContext failed"; return NULL; } - if (!context->MakeCurrent()) { + if (!context->MakeCurrent(surface)) { LOG(ERROR) << "gfx::GLContext::MakeCurrent() failed"; return NULL; } @@ -81,7 +79,16 @@ namespace gpu_info_collector { bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); - scoped_ptr<gfx::GLContext> context(InitializeGLContext()); + if (!gfx::GLSurface::InitializeOneOff()) { + LOG(ERROR) << "gfx::GLContext::InitializeOneOff() failed"; + return false; + } + + scoped_ptr<gfx::GLSurface> surface(InitializeGLSurface()); + if (!surface.get()) + return false; + + scoped_ptr<gfx::GLContext> context(InitializeGLContext(surface.get())); if (!context.get()) return false; |