summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authordominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-27 18:26:57 +0000
committerdominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-27 18:26:57 +0000
commitcd1f2455551054586a441fff03f15a92e31114e9 (patch)
tree03b86c075f636374ebd5f0f2a113006e6d1b17c8 /gpu
parentdac716a0ab0c600bfef13d2738ce749bdc13b03a (diff)
downloadchromium_src-cd1f2455551054586a441fff03f15a92e31114e9.zip
chromium_src-cd1f2455551054586a441fff03f15a92e31114e9.tar.gz
chromium_src-cd1f2455551054586a441fff03f15a92e31114e9.tar.bz2
Change X11 error handler override to allow easy X11 error checking.
BUG=None TEST=None Review URL: http://codereview.chromium.org/7889040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/DEPS2
-rw-r--r--gpu/command_buffer/common/gl_mock.h6
-rw-r--r--gpu/command_buffer/service/buffer_manager_unittest.cc8
-rw-r--r--gpu/command_buffer/service/framebuffer_manager_unittest.cc11
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc11
-rw-r--r--gpu/command_buffer/service/id_manager_unittest.cc10
-rw-r--r--gpu/command_buffer/service/program_manager_unittest.cc7
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager_unittest.cc9
-rw-r--r--gpu/command_buffer/service/shader_manager_unittest.cc8
-rw-r--r--gpu/command_buffer/service/texture_manager_unittest.cc8
-rw-r--r--gpu/command_buffer/service/vertex_attrib_manager_unittest.cc8
11 files changed, 61 insertions, 27 deletions
diff --git a/gpu/DEPS b/gpu/DEPS
index b357d81..5c266a4 100644
--- a/gpu/DEPS
+++ b/gpu/DEPS
@@ -8,6 +8,8 @@ include_rules = [
"+../GLES2",
"+../service",
+ # For ui::CheckFailOnReportedX11Error
+ "+ui/base",
# For gfx::PluginWindowHandle
"+ui/gfx",
]
diff --git a/gpu/command_buffer/common/gl_mock.h b/gpu/command_buffer/common/gl_mock.h
index 4c5c114..29fb000 100644
--- a/gpu/command_buffer/common/gl_mock.h
+++ b/gpu/command_buffer/common/gl_mock.h
@@ -9,6 +9,11 @@
#define GPU_COMMAND_BUFFER_COMMON_GL_MOCK_H_
#pragma once
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/gfx/gl/gl_interface.h"
@@ -450,4 +455,3 @@ class MockGLInterface : public GLInterface {
} // namespace gfx
#endif // GPU_COMMAND_BUFFER_COMMON_GL_MOCK_H_
-
diff --git a/gpu/command_buffer/service/buffer_manager_unittest.cc b/gpu/command_buffer/service/buffer_manager_unittest.cc
index 1e4258b..8cd095dc 100644
--- a/gpu/command_buffer/service/buffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/buffer_manager_unittest.cc
@@ -2,9 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "gpu/command_buffer/service/buffer_manager.h"
#include "gpu/command_buffer/common/gl_mock.h"
-#include "testing/gtest/include/gtest/gtest.h"
namespace gpu {
namespace gles2 {
@@ -223,5 +227,3 @@ TEST_F(BufferManagerTest, GetMaxValueForRangeUint32) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/framebuffer_manager_unittest.cc b/gpu/command_buffer/service/framebuffer_manager_unittest.cc
index 77c6622..7bd4872 100644
--- a/gpu/command_buffer/service/framebuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/framebuffer_manager_unittest.cc
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
+#include "gpu/command_buffer/common/gl_mock.h"
#include "gpu/command_buffer/service/framebuffer_manager.h"
#include "gpu/command_buffer/service/feature_info.h"
-#include "gpu/command_buffer/common/gl_mock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
namespace gpu {
namespace gles2 {
@@ -364,5 +367,3 @@ TEST_F(FramebufferInfoTest, AttachTexture) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index d6c513e..82b16de 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -15,6 +15,7 @@
#include "base/atomicops.h"
#include "base/at_exit.h"
#include "base/callback.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
@@ -40,6 +41,13 @@
#include "ui/gfx/gl/gl_implementation.h"
#include "ui/gfx/gl/gl_surface.h"
+#if defined(USE_X11)
+#include "ui/base/x/x11_util_internal.h"
+#define CHECK_X_ERROR() ui::CheckForReportedX11Error()
+#else // USE_X11
+#define CHECK_X_ERROR() void(0)
+#endif // USE_X11
+
#if !defined(GL_DEPTH24_STENCIL8)
#define GL_DEPTH24_STENCIL8 0x88F0
#endif
@@ -1732,6 +1740,8 @@ bool GLES2DecoderImpl::Initialize(
// Take ownership of the GLContext.
context_ = context;
+ CHECK_X_ERROR();
+
if (!MakeCurrent()) {
LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because "
<< "MakeCurrent failed.";
@@ -1746,6 +1756,7 @@ bool GLES2DecoderImpl::Initialize(
return false;
}
+ CHECK_X_ERROR();
CHECK_GL_ERROR();
disallowed_features_ = disallowed_features;
diff --git a/gpu/command_buffer/service/id_manager_unittest.cc b/gpu/command_buffer/service/id_manager_unittest.cc
index 015a442..7f7e676 100644
--- a/gpu/command_buffer/service/id_manager_unittest.cc
+++ b/gpu/command_buffer/service/id_manager_unittest.cc
@@ -1,9 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gpu/command_buffer/service/id_manager.h"
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
#include "testing/gtest/include/gtest/gtest.h"
+#include "gpu/command_buffer/service/id_manager.h"
namespace gpu {
namespace gles2 {
@@ -72,5 +76,3 @@ TEST_F(IdManagerTest, Basic) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc
index c58cda1..b5f7cc3 100644
--- a/gpu/command_buffer/service/program_manager_unittest.cc
+++ b/gpu/command_buffer/service/program_manager_unittest.cc
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "gpu/command_buffer/service/program_manager.h"
#include <algorithm>
@@ -900,5 +905,3 @@ TEST_F(ProgramManagerWithShaderTest, ProgramInfoGetProgramInfo) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
index c68b599..c12e451 100644
--- a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
@@ -1,7 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "gpu/command_buffer/service/renderbuffer_manager.h"
#include "gpu/command_buffer/common/gl_mock.h"
@@ -117,5 +122,3 @@ TEST_F(RenderbufferManagerTest, RenderbufferInfo) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/shader_manager_unittest.cc b/gpu/command_buffer/service/shader_manager_unittest.cc
index 23590b78..2aed8d9 100644
--- a/gpu/command_buffer/service/shader_manager_unittest.cc
+++ b/gpu/command_buffer/service/shader_manager_unittest.cc
@@ -2,12 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "gpu/command_buffer/service/shader_manager.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/command_buffer/common/gl_mock.h"
#include "gpu/command_buffer/service/mocks.h"
-#include "testing/gtest/include/gtest/gtest.h"
using ::testing::Return;
using ::testing::ReturnRef;
@@ -242,5 +246,3 @@ TEST_F(ShaderManagerTest, ShaderInfoUseCount) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index cf33e72..fe0392b 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -2,13 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/command_buffer/common/gl_mock.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/test_helper.h"
-#include "testing/gtest/include/gtest/gtest.h"
using ::testing::Pointee;
using ::testing::_;
@@ -727,5 +731,3 @@ TEST_F(TextureInfoTest, EGLImageExternal) {
} // namespace gles2
} // namespace gpu
-
-
diff --git a/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc b/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc
index 49c1883..fb5e26c 100644
--- a/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc
+++ b/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc
@@ -2,13 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
+// gtest uses as struct names (inside a namespace). This means that
+// #include'ing gtest after anything that pulls in X.h fails to compile.
+// This is http://code.google.com/p/googletest/issues/detail?id=371
+#include "testing/gtest/include/gtest/gtest.h"
#include "gpu/command_buffer/service/vertex_attrib_manager.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/command_buffer/common/gl_mock.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/test_helper.h"
-#include "testing/gtest/include/gtest/gtest.h"
using ::testing::Pointee;
using ::testing::_;
@@ -176,5 +180,3 @@ TEST_F(VertexAttribManagerTest, CanAccess) {
} // namespace gles2
} // namespace gpu
-
-