haikuwebkit/ManualTests/crash-and-no-repaint-after-...

187 lines
5.7 KiB
HTML
Raw Permalink Normal View History

Fix a crash when a page that uses accelerated compositing loads soon after the computer wakes from sleep The set-up: For a short time after waking from sleep, IDirect3D9::CreateDevice will fail. This caused WKCACFLayerRenderer::createRenderer to fail, and meant that WKCACFLayerRenderer never allocated a root layer. WebView wouldn't notice that createRenderer failed, and would go ahead and try to use the root layer anyway, resulting in a crash. The fix: We now allocate the root layer (and all the other members of WKCACFLayerRenderer that aren't dependent on having an IDirect3DDevice9) in WKCACFLayerRenderer's constructor. This way the layers will always be present, even when creating the D3D device fails. There are two remaining problems: 1) This results in slightly more memory usage in the case where CreateDevice fails. 2) Once we get into this bad state, the WebView doesn't repaint until we navigate somewhere else. (2) is covered by <http://webkit.org/b/39297>/<rdar://problem/7997431>. We'll fix it by retrying CreateDevice later in hopes that it will succeed after more time has passed. This will in turn fix (1). (We should never end up in a case where CreateDevice fails forever because we already did some preliminary checks in acceleratedCompositingAvailable().) Fixes <http://webkit.org/b/39295> <rdar://problem/7971319> Crash (preceded by assertion) in WKCACFLayerRenderer::setNeedsDisplay when computer wakes from sleep on particular page Reviewed by John Sullivan. * manual-tests/crash-after-wake-from-sleep.html: Added. This is the Poster Circle demo from webkit.org/blog, but modified to automatically reload every 5 seconds and with instructions to put the computer to sleep and wake it up again. * platform/graphics/win/WKCACFLayerRenderer.cpp: (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Moved code to initialize m_context, m_renderContext, and m_*Layer here... (WebCore::WKCACFLayerRenderer::createRenderer): ...from here. Canonical link: https://commits.webkit.org/50818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-05-18 19:32:46 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
Make WKCACFLayerRenderer robust against temporary failure of Direct3DCreate9 and IDirect3D9::CreateDevice For a short time after waking from sleep, Direct3DCreate9() will return an IDirect3D9 for which IDirect3D9::CreateDevice will always fail. Also during this time period, IDirect3D9::CreateDevice will fail even for non-bad IDirect3D9s. (It will later start succeeding.) WKCACFLayerRenderer now works around this behavior by detecting when it might be in this situation and calling these functions again later. Fixes <http://webkit.org/b/39297> <rdar://problem/7997431> WebView doesn't repaint until page reloads when page using hardware acceleration loads just after waking from sleep Reviewed by John Sullivan. * manual-tests/crash-and-no-repaint-after-wake-from-sleep.html: Renamed from WebCore/manual-tests/crash-after-wake-from-sleep.html. Modified to also include instructions for reproducing this bug. * platform/graphics/win/WKCACFLayerRenderer.cpp: (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Replaced m_triedToCreateD3DRenderer with m_mightBeAbleToCreateDeviceLater. The new member is initialized to true, since we haven't even tried to create a device once yet. (WebCore::WKCACFLayerRenderer::createRenderer): If we already have a D3D device, or we don't have one and are sure that we won't be able to create one later, just return the previously-created device, if any. We assume that we won't be able to create a device later if this function fails, unless the function fails due to CreateDevice failing. As noted above, CreateDevice will sometimes temporarily fail and then later start working again. When CreateDevice fails, we also assume that we might have a bad IDirect3D9, so we get rid of the one we have so a new (and hopefully non-bad) one will be allocated later. (WebCore::WKCACFLayerRenderer::destroyRenderer): Reset m_mightBeAbleToCreateDeviceLater to true, since we no longer have a device. (WebCore::WKCACFLayerRenderer::paint): Before trying to paint, try to create our D3D device and renderer. If this fails, we bail out, but if we think we might be able to create a device later we schedule another paint (via renderSoon()) so that we'll try again soon. * platform/graphics/win/WKCACFLayerRenderer.h: Replaced m_triedToCreateD3DRenderer with m_mightBeAbleToCreateDeviceLater. Canonical link: https://commits.webkit.org/50819@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-05-18 19:33:10 +00:00
<title>Test for Bugs 39295 and 39297</title>
Fix a crash when a page that uses accelerated compositing loads soon after the computer wakes from sleep The set-up: For a short time after waking from sleep, IDirect3D9::CreateDevice will fail. This caused WKCACFLayerRenderer::createRenderer to fail, and meant that WKCACFLayerRenderer never allocated a root layer. WebView wouldn't notice that createRenderer failed, and would go ahead and try to use the root layer anyway, resulting in a crash. The fix: We now allocate the root layer (and all the other members of WKCACFLayerRenderer that aren't dependent on having an IDirect3DDevice9) in WKCACFLayerRenderer's constructor. This way the layers will always be present, even when creating the D3D device fails. There are two remaining problems: 1) This results in slightly more memory usage in the case where CreateDevice fails. 2) Once we get into this bad state, the WebView doesn't repaint until we navigate somewhere else. (2) is covered by <http://webkit.org/b/39297>/<rdar://problem/7997431>. We'll fix it by retrying CreateDevice later in hopes that it will succeed after more time has passed. This will in turn fix (1). (We should never end up in a case where CreateDevice fails forever because we already did some preliminary checks in acceleratedCompositingAvailable().) Fixes <http://webkit.org/b/39295> <rdar://problem/7971319> Crash (preceded by assertion) in WKCACFLayerRenderer::setNeedsDisplay when computer wakes from sleep on particular page Reviewed by John Sullivan. * manual-tests/crash-after-wake-from-sleep.html: Added. This is the Poster Circle demo from webkit.org/blog, but modified to automatically reload every 5 seconds and with instructions to put the computer to sleep and wake it up again. * platform/graphics/win/WKCACFLayerRenderer.cpp: (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Moved code to initialize m_context, m_renderContext, and m_*Layer here... (WebCore::WKCACFLayerRenderer::createRenderer): ...from here. Canonical link: https://commits.webkit.org/50818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-05-18 19:32:46 +00:00
<meta http-equiv="refresh" content="5">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=0.60, minimum-scale=0.60, maximum-scale=0.60">
<style type="text/css">
body {
font-family: 'Lucida Grande', Verdana, Arial;
font-size: 12px;
}
#stage {
margin: 150px auto;
width: 600px;
height: 400px;
/*
Setting the perspective of the contents of the stage
but not the stage itself
*/
-webkit-perspective: 800;
}
#rotate {
margin: 0 auto;
width: 600px;
height: 400px;
/* Ensure that we're in 3D space */
-webkit-transform-style: preserve-3d;
/*
Make the whole set of rows use the x-axis spin animation
for a duration of 7 seconds, running infinitely and linearly
*/
-webkit-animation-name: x-spin;
-webkit-animation-duration: 7s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
.ring {
margin: 0 auto;
height: 110px;
width: 600px;
-webkit-transform-style: preserve-3d;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
.ring > :nth-child(odd) {
background-color: #995C7F;
}
.ring > :nth-child(even) {
background-color: #835A99;
}
.poster {
position: absolute;
left: 250px;
width: 100px;
height: 100px;
opacity: 0.7;
color: rgba(0,0,0,0.9);
-webkit-border-radius: 10px;
}
.poster > p {
font-family: 'Georgia', serif;
font-size: 36px;
font-weight: bold;
text-align: center;
margin-top: 28px;
}
/*
Set up each row to have a different animation duration
and alternating y-axis rotation directions.
*/
#ring-1 {
-webkit-animation-name: y-spin;
-webkit-animation-duration: 5s;
}
#ring-2 {
-webkit-animation-name: back-y-spin;
-webkit-animation-duration: 4s;
}
#ring-3 {
-webkit-animation-name: y-spin;
-webkit-animation-duration: 3s;
}
/*
Here we define each of the three individual animations that
we will be using to have our 3D rotation effect. The first
animation will perform a full rotation on the x-axis, we'll
use that on the whole set of objects. The second and third
animations will perform a full rotation on the y-axis in
opposite directions, alternating directions between rows.
Note that you currently have to specify an intermediate step
for rotations even when you are using individual transformation
constructs.
*/
@-webkit-keyframes x-spin {
0% { -webkit-transform: rotateX(0deg); }
50% { -webkit-transform: rotateX(180deg); }
100% { -webkit-transform: rotateX(360deg); }
}
@-webkit-keyframes y-spin {
0% { -webkit-transform: rotateY(0deg); }
50% { -webkit-transform: rotateY(180deg); }
100% { -webkit-transform: rotateY(360deg); }
}
@-webkit-keyframes back-y-spin {
0% { -webkit-transform: rotateY(360deg); }
50% { -webkit-transform: rotateY(180deg); }
100% { -webkit-transform: rotateY(0deg); }
}
</style>
<script type="text/javascript">
const POSTERS_PER_ROW = 12;
const RING_RADIUS = 200;
function setup_posters (row)
{
var posterAngle = 360 / POSTERS_PER_ROW;
for (var i = 0; i < POSTERS_PER_ROW; i ++) {
var poster = document.createElement('div');
poster.className = 'poster';
// compute and assign the transform for this poster
var transform = 'rotateY(' + (posterAngle * i) + 'deg) translateZ(' + RING_RADIUS + 'px)';
poster.style.webkitTransform = transform;
// setup the number to show inside the poster
var content = poster.appendChild(document.createElement('p'));
content.textContent = i;
// add the poster to the row
row.appendChild(poster);
}
}
function init ()
{
setup_posters(document.getElementById('ring-1'));
setup_posters(document.getElementById('ring-2'));
setup_posters(document.getElementById('ring-3'));
}
// call init once the document is fully loaded
window.addEventListener('load', init, false);
</script>
</head>
<body>
Make WKCACFLayerRenderer robust against temporary failure of Direct3DCreate9 and IDirect3D9::CreateDevice For a short time after waking from sleep, Direct3DCreate9() will return an IDirect3D9 for which IDirect3D9::CreateDevice will always fail. Also during this time period, IDirect3D9::CreateDevice will fail even for non-bad IDirect3D9s. (It will later start succeeding.) WKCACFLayerRenderer now works around this behavior by detecting when it might be in this situation and calling these functions again later. Fixes <http://webkit.org/b/39297> <rdar://problem/7997431> WebView doesn't repaint until page reloads when page using hardware acceleration loads just after waking from sleep Reviewed by John Sullivan. * manual-tests/crash-and-no-repaint-after-wake-from-sleep.html: Renamed from WebCore/manual-tests/crash-after-wake-from-sleep.html. Modified to also include instructions for reproducing this bug. * platform/graphics/win/WKCACFLayerRenderer.cpp: (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Replaced m_triedToCreateD3DRenderer with m_mightBeAbleToCreateDeviceLater. The new member is initialized to true, since we haven't even tried to create a device once yet. (WebCore::WKCACFLayerRenderer::createRenderer): If we already have a D3D device, or we don't have one and are sure that we won't be able to create one later, just return the previously-created device, if any. We assume that we won't be able to create a device later if this function fails, unless the function fails due to CreateDevice failing. As noted above, CreateDevice will sometimes temporarily fail and then later start working again. When CreateDevice fails, we also assume that we might have a bad IDirect3D9, so we get rid of the one we have so a new (and hopefully non-bad) one will be allocated later. (WebCore::WKCACFLayerRenderer::destroyRenderer): Reset m_mightBeAbleToCreateDeviceLater to true, since we no longer have a device. (WebCore::WKCACFLayerRenderer::paint): Before trying to paint, try to create our D3D device and renderer. If this fails, we bail out, but if we think we might be able to create a device later we schedule another paint (via renderSoon()) so that we'll try again soon. * platform/graphics/win/WKCACFLayerRenderer.h: Replaced m_triedToCreateD3DRenderer with m_mightBeAbleToCreateDeviceLater. Canonical link: https://commits.webkit.org/50819@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-05-18 19:33:10 +00:00
<p>This is a combined test for <a href="https://bugs.webkit.org/show_bug.cgi?id=39295">Bug 39295: Crash (preceded by
assertion) in WKCACFLayerRenderer::setNeedsDisplay when computer wakes from sleep on particular page</a> and <a
href="https://bugs.webkit.org/show_bug.cgi?id=39297">Bug 39297: WebView doesn't repaint until page reloads when page
using hardware acceleration loads just after waking from sleep</a>. To test, put your computer to sleep (or
"Standby", as Windows calls it). When you wake your computer up, the browser should not crash and the animation
below should still be running without any periods of non-painting of the WebView.</p>
Fix a crash when a page that uses accelerated compositing loads soon after the computer wakes from sleep The set-up: For a short time after waking from sleep, IDirect3D9::CreateDevice will fail. This caused WKCACFLayerRenderer::createRenderer to fail, and meant that WKCACFLayerRenderer never allocated a root layer. WebView wouldn't notice that createRenderer failed, and would go ahead and try to use the root layer anyway, resulting in a crash. The fix: We now allocate the root layer (and all the other members of WKCACFLayerRenderer that aren't dependent on having an IDirect3DDevice9) in WKCACFLayerRenderer's constructor. This way the layers will always be present, even when creating the D3D device fails. There are two remaining problems: 1) This results in slightly more memory usage in the case where CreateDevice fails. 2) Once we get into this bad state, the WebView doesn't repaint until we navigate somewhere else. (2) is covered by <http://webkit.org/b/39297>/<rdar://problem/7997431>. We'll fix it by retrying CreateDevice later in hopes that it will succeed after more time has passed. This will in turn fix (1). (We should never end up in a case where CreateDevice fails forever because we already did some preliminary checks in acceleratedCompositingAvailable().) Fixes <http://webkit.org/b/39295> <rdar://problem/7971319> Crash (preceded by assertion) in WKCACFLayerRenderer::setNeedsDisplay when computer wakes from sleep on particular page Reviewed by John Sullivan. * manual-tests/crash-after-wake-from-sleep.html: Added. This is the Poster Circle demo from webkit.org/blog, but modified to automatically reload every 5 seconds and with instructions to put the computer to sleep and wake it up again. * platform/graphics/win/WKCACFLayerRenderer.cpp: (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Moved code to initialize m_context, m_renderContext, and m_*Layer here... (WebCore::WKCACFLayerRenderer::createRenderer): ...from here. Canonical link: https://commits.webkit.org/50818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-05-18 19:32:46 +00:00
<div id="stage">
<div id="rotate">
<div id="ring-1" class="ring"></div>
<div id="ring-2" class="ring"></div>
<div id="ring-3" class="ring"></div>
</div>
</div>
</body>
</html>