diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 19:41:58 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 19:41:58 +0000 |
commit | 333c5c9ca65425d1796d9d13abda37ecbce2c9fb (patch) | |
tree | 85b92482a6ed18f7be48b153352436be89eb5b3e /content/gpu | |
parent | 374d9094395c15cd3b337de5c36587312fcc8a1e (diff) | |
download | chromium_src-333c5c9ca65425d1796d9d13abda37ecbce2c9fb.zip chromium_src-333c5c9ca65425d1796d9d13abda37ecbce2c9fb.tar.gz chromium_src-333c5c9ca65425d1796d9d13abda37ecbce2c9fb.tar.bz2 |
Revert 85013 - Split GLContext::Create*GLContext into GLSurface::Create*GLSurface plus a surface type independent GLContext::CreateGLContext.
TEST=webgl on windows and mac, trybots
BUG=none
Review URL: http://codereview.chromium.org/6997003
TBR=apatrick@chromium.org
Review URL: http://codereview.chromium.org/7015003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/gpu')
-rw-r--r-- | content/gpu/gpu_child_thread.cc | 4 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector.cc | 31 |
2 files changed, 13 insertions, 22 deletions
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc index 8612a66..c9a5acd 100644 --- a/content/gpu/gpu_child_thread.cc +++ b/content/gpu/gpu_child_thread.cc @@ -18,8 +18,8 @@ #include "content/gpu/gpu_info_collector.h" #include "content/gpu/gpu_watchdog_thread.h" #include "ipc/ipc_channel_handle.h" +#include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_implementation.h" -#include "ui/gfx/gl/gl_surface.h" #if defined(OS_MACOSX) #include "content/common/sandbox_init_wrapper.h" @@ -121,7 +121,7 @@ void GpuChildThread::OnInitialize() { // Load the GL implementation and locate the bindings before starting the GPU // watchdog because this can take a lot of time and the GPU watchdog might // terminate the GPU process. - if (!gfx::GLSurface::InitializeOneOff()) { + if (!gfx::GLContext::InitializeOneOff()) { LOG(INFO) << "GLContext::InitializeOneOff failed"; MessageLoop::current()->Quit(); return; diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc index d3492fd..6b37c27 100644 --- a/content/gpu/gpu_info_collector.cc +++ b/content/gpu/gpu_info_collector.cc @@ -7,45 +7,34 @@ #include <string> #include <vector> -#include "base/memory/scoped_ptr.h" #include "base/logging.h" #include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_split.h" #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_context.h" -#include "ui/gfx/gl/gl_surface.h" namespace { // This creates an offscreen GL context for gl queries. Returned GLContext // should be deleted in FinalizeGLContext. gfx::GLContext* InitializeGLContext() { - if (!gfx::GLSurface::InitializeOneOff()) { + if (!gfx::GLContext::InitializeOneOff()) { LOG(ERROR) << "gfx::GLContext::InitializeOneOff() failed"; return NULL; } - scoped_ptr<gfx::GLSurface> surface(gfx::GLSurface::CreateOffscreenGLSurface( - gfx::Size(1, 1))); - if (!surface.get()) { - LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; + gfx::GLContext* context = gfx::GLContext::CreateOffscreenGLContext(NULL); + if (context == NULL) { + LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLContext(NULL) failed"; return NULL; } - - scoped_ptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext( - surface.release(), - NULL)); - if (!context.get()) { - LOG(ERROR) << "gfx::GLContext::CreateGLContext failed"; - return NULL; - } - if (!context->MakeCurrent()) { LOG(ERROR) << "gfx::GLContext::MakeCurrent() failed"; + context->Destroy(); + delete context; return NULL; } - - return context.release(); + return context; } // This destroy and delete the GL context. @@ -91,8 +80,8 @@ namespace gpu_info_collector { bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); - scoped_ptr<gfx::GLContext> context(InitializeGLContext()); - if (!context.get()) + gfx::GLContext* context = InitializeGLContext(); + if (context == NULL) return false; gpu_info->gl_renderer = GetGLString(GL_RENDERER); @@ -104,6 +93,8 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { bool validVideoCardInfo = CollectVideoCardInfo(gpu_info); bool validDriverInfo = CollectDriverInfoGL(gpu_info); + FinalizeGLContext(&context); + return (validGLVersionInfo && validVideoCardInfo && validDriverInfo); } |