diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 4 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector.cc | 31 |
2 files changed, 21 insertions, 14 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 199e933..0c852ad 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -414,8 +414,8 @@ void GpuCommandBufferStub::ViewResized() { // Recreate the view surface to match the window size. TODO(apatrick): this is // likely not necessary on all platforms. gfx::GLContext* context = scheduler_->decoder()->GetGLContext(); - context->ReleaseCurrent(); - gfx::GLSurface* surface = context->GetSurface(); + gfx::GLSurface* surface = scheduler_->decoder()->GetGLSurface(); + context->ReleaseCurrent(surface); if (surface) { surface->Destroy(); surface->Initialize(); 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; |