summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 01:26:34 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 01:26:34 +0000
commit18f33115e6e23ac4da992825625d48814b7a0af8 (patch)
treed31516d4733ef5daa811272d5ccced18ce41477a /app
parent5d4dc8a5c5f9dd43a637bc09645289055accbfb7 (diff)
downloadchromium_src-18f33115e6e23ac4da992825625d48814b7a0af8.zip
chromium_src-18f33115e6e23ac4da992825625d48814b7a0af8.tar.gz
chromium_src-18f33115e6e23ac4da992825625d48814b7a0af8.tar.bz2
OSMesa SwapBuffers does not fail if the window handle is invalid on windows.
This is because the primary application of this class of GLContext is for testing and we do not want every GL related ui browser test to become flaky if there is a race condition between GL context destruction and window destruction. TEST=try BUG=none Review URL: http://codereview.chromium.org/4458001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/gfx/gl/gl_context_win.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/app/gfx/gl/gl_context_win.cc b/app/gfx/gl/gl_context_win.cc
index 80af050..b2c35a7 100644
--- a/app/gfx/gl/gl_context_win.cc
+++ b/app/gfx/gl/gl_context_win.cc
@@ -495,14 +495,22 @@ bool OSMesaViewGLContext::SwapBuffers() {
info.bV4BlueMask = 0x00FF0000;
info.bV4AlphaMask = 0xFF000000;
- // Copy the back buffer to the window's device context.
- return StretchDIBits(device_context_,
- 0, 0, size.width(), size.height(),
- 0, 0, size.width(), size.height(),
- osmesa_context_.buffer(),
- reinterpret_cast<BITMAPINFO*>(&info),
- DIB_RGB_COLORS,
- SRCCOPY) != 0;
+ // Copy the back buffer to the window's device context. Do not check whether
+ // StretchDIBits succeeds or not. It will fail if the window has been
+ // destroyed but it is preferable to allow rendering to silently fail if the
+ // window is destroyed. This is because the primary application of this
+ // class of GLContext is for testing and we do not want every GL related ui /
+ // browser test to become flaky if there is a race condition between GL
+ // context destruction and window destruction.
+ StretchDIBits(device_context_,
+ 0, 0, size.width(), size.height(),
+ 0, 0, size.width(), size.height(),
+ osmesa_context_.buffer(),
+ reinterpret_cast<BITMAPINFO*>(&info),
+ DIB_RGB_COLORS,
+ SRCCOPY);
+
+ return true;
}
gfx::Size OSMesaViewGLContext::GetSize() {
@@ -520,7 +528,8 @@ void OSMesaViewGLContext::SetSwapInterval(int interval) {
}
void OSMesaViewGLContext::UpdateSize() {
- // Change back buffer size to that of window.
+ // Change back buffer size to that of window. If window handle is invalid, do
+ // not change the back buffer size.
RECT rect;
if (!GetClientRect(window_, &rect))
return;