diff options
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/common/unittest_main.cc | 11 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc | 6 | ||||
-rw-r--r-- | gpu/config/gpu_info_collector.cc | 4 | ||||
-rw-r--r-- | gpu/config/gpu_info_collector_android.cc | 16 | ||||
-rw-r--r-- | gpu/config/gpu_info_collector_unittest.cc | 6 | ||||
-rw-r--r-- | gpu/tools/compositor_model_bench/compositor_model_bench.cc | 7 |
6 files changed, 30 insertions, 20 deletions
diff --git a/gpu/command_buffer/common/unittest_main.cc b/gpu/command_buffer/common/unittest_main.cc index 358805a..c48b77d 100644 --- a/gpu/command_buffer/common/unittest_main.cc +++ b/gpu/command_buffer/common/unittest_main.cc @@ -11,7 +11,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_mock.h" -#include "ui/gl/gl_surface.h" namespace { @@ -20,13 +19,6 @@ class NoAtExitBaseTestSuite : public base::TestSuite { NoAtExitBaseTestSuite(int argc, char** argv) : base::TestSuite(argc, argv, false) { } - - virtual void Initialize() OVERRIDE { - base::TestSuite::Initialize(); - gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); - gfx::GLSurface::InitializeOneOffWithMockBindingsForTests(); - gfx::GLSurface::InitializeDynamicMockBindingsForTests(NULL); - } }; int RunTestSuite(int argc, char** argv) { @@ -43,6 +35,9 @@ int main(int argc, char** argv) { base::AtExitManager exit_manager; #endif CommandLine::Init(argc, argv); + gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); + gfx::InitializeStaticGLBindings(gfx::kGLImplementationMockGL); + gfx::InitializeDynamicGLBindings(gfx::kGLImplementationMockGL, NULL); testing::InitGoogleMock(&argc, argv); return base::LaunchUnitTests(argc, argv, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index c41777a..097d8cd 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -22,7 +22,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_mock.h" -#include "ui/gl/gl_surface.h" using ::gfx::MockGLInterface; using ::testing::_; @@ -116,8 +115,9 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine( const CommandLine* command_line) { Framebuffer::ClearFramebufferCompleteComboMap(); + gfx::ClearGLBindings(); gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); - gfx::GLSurface::InitializeOneOffWithMockBindingsForTests(); + gfx::InitializeStaticGLBindings(gfx::kGLImplementationMockGL); gl_.reset(new StrictMock<MockGLInterface>()); ::gfx::MockGLInterface::SetGLInterface(gl_.get()); @@ -289,7 +289,7 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine( context_->SetGLVersionString(gl_version); context_->MakeCurrent(surface_.get()); - gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_); + gfx::InitializeDynamicGLBindings(gfx::kGLImplementationMockGL, context_); int32 attributes[] = { EGL_ALPHA_SIZE, request_alpha ? 8 : 0, diff --git a/gpu/config/gpu_info_collector.cc b/gpu/config/gpu_info_collector.cc index 9404f3a..0bb83dd 100644 --- a/gpu/config/gpu_info_collector.cc +++ b/gpu/config/gpu_info_collector.cc @@ -82,6 +82,10 @@ namespace gpu { bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { TRACE_EVENT0("startup", "gpu_info_collector::CollectGraphicsInfoGL"); + if (!gfx::GLSurface::InitializeOneOff()) { + LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed"; + return false; + } scoped_refptr<gfx::GLSurface> surface(InitializeGLSurface()); if (!surface.get()) diff --git a/gpu/config/gpu_info_collector_android.cc b/gpu/config/gpu_info_collector_android.cc index 03f357e..79428a1 100644 --- a/gpu/config/gpu_info_collector_android.cc +++ b/gpu/config/gpu_info_collector_android.cc @@ -65,19 +65,23 @@ ScopedRestoreNonOwnedEGLContext::ScopedRestoreNonOwnedEGLContext() // Chromium native code, but created by Android system itself. DCHECK(!gfx::GLContext::GetCurrent()); - context_ = eglGetCurrentContext(); - display_ = eglGetCurrentDisplay(); - draw_surface_ = eglGetCurrentSurface(EGL_DRAW); - read_surface_ = eglGetCurrentSurface(EGL_READ); + if (gfx::GLSurface::InitializeOneOff()) { + context_ = eglGetCurrentContext(); + display_ = eglGetCurrentDisplay(); + draw_surface_ = eglGetCurrentSurface(EGL_DRAW); + read_surface_ = eglGetCurrentSurface(EGL_READ); + } } ScopedRestoreNonOwnedEGLContext::~ScopedRestoreNonOwnedEGLContext() { if (context_ == EGL_NO_CONTEXT || display_ == EGL_NO_DISPLAY || - draw_surface_ == EGL_NO_SURFACE || read_surface_ == EGL_NO_SURFACE) + draw_surface_ == EGL_NO_SURFACE || read_surface_ == EGL_NO_SURFACE) { return; + } - if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) + if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) { LOG(WARNING) << "Failed to restore EGL context"; + } } } diff --git a/gpu/config/gpu_info_collector_unittest.cc b/gpu/config/gpu_info_collector_unittest.cc index 0629359..9c0adbf 100644 --- a/gpu/config/gpu_info_collector_unittest.cc +++ b/gpu/config/gpu_info_collector_unittest.cc @@ -7,6 +7,7 @@ #include "gpu/config/gpu_info_collector.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gl/gl_implementation.h" #include "ui/gl/gl_mock.h" using ::gfx::MockGLInterface; @@ -20,6 +21,11 @@ class GPUInfoCollectorTest : public testing::Test { virtual ~GPUInfoCollectorTest() { } virtual void SetUp() { + // TODO(kbr): make this setup robust in the case where + // GLSurface::InitializeOneOff() has already been called by + // another unit test. http://crbug.com/100285 + gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); + gfx::InitializeStaticGLBindings(gfx::kGLImplementationMockGL); gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); ::gfx::MockGLInterface::SetGLInterface(gl_.get()); #if defined(OS_WIN) diff --git a/gpu/tools/compositor_model_bench/compositor_model_bench.cc b/gpu/tools/compositor_model_bench/compositor_model_bench.cc index 6c60382..44ce333 100644 --- a/gpu/tools/compositor_model_bench/compositor_model_bench.cc +++ b/gpu/tools/compositor_model_bench/compositor_model_bench.cc @@ -31,10 +31,11 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/time/time.h" + #include "gpu/tools/compositor_model_bench/render_model_utils.h" #include "gpu/tools/compositor_model_bench/render_models.h" #include "gpu/tools/compositor_model_bench/render_tree.h" -#include "ui/gl/gl_surface.h" + using base::TimeTicks; using base::DirectoryExists; @@ -185,8 +186,8 @@ class Simulator { // Initialize the OpenGL context. bool InitGLContext() { - if (!gfx::GLSurface::InitializeOneOff()) { - LOG(FATAL) << "gfx::GLSurface::InitializeOneOff failed"; + if (!InitializeStaticGLBindings(gfx::kGLImplementationDesktopGL)) { + LOG(FATAL) << "InitializeStaticGLBindings failed"; return false; } |