Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp |
diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
index 41dbd23d306f571c20f7bf5f30639e0323032d70..7d2bed7b82b61a52756ba8017006ff2cb5e0b91e 100644 |
--- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
@@ -4132,8 +4132,7 @@ void WebGLRenderingContextBase::loseContextImpl(WebGLRenderingContextBase::LostC |
removeAllCompressedTextureFormats(); |
- if (mode != RealLostContext) |
- destroyContext(); |
+ destroyContext(); |
ConsoleDisplayPreference display = (mode == RealLostContext) ? DisplayInConsole: DontDisplayInConsole; |
synthesizeGLError(GC3D_CONTEXT_LOST_WEBGL, "loseContext", "context lost", display); |
@@ -5336,6 +5335,20 @@ void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextB |
blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes->attributes(canvas()->document().topDocument().url().string(), settings); |
OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes)); |
+ |
+ if (context) { |
+ RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptRef(new WebGLRenderingContextEvictionManager()); |
+ |
+ // Construct a new drawing buffer with the new WebGraphicsContext3D. |
+ m_drawingBuffer->releaseResources(); |
+ DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->preserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
+ m_drawingBuffer = DrawingBuffer::create(context.get(), clampedCanvasSize(), preserve, contextEvictionManager.release()); |
+ |
+ if (m_drawingBuffer->isZeroSized()) { |
+ m_drawingBuffer->releaseResources(); |
+ context.clear(); |
+ } |
+ } |
if (!context) { |
if (m_contextLostMode == RealLostContext) { |
m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts); |
@@ -5346,16 +5359,6 @@ void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextB |
return; |
} |
- RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptRef(new WebGLRenderingContextEvictionManager()); |
- |
- // Construct a new drawing buffer with the new WebGraphicsContext3D. |
- m_drawingBuffer->releaseResources(); |
- DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->preserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
- m_drawingBuffer = DrawingBuffer::create(context.get(), clampedCanvasSize(), preserve, contextEvictionManager.release()); |
- |
- if (m_drawingBuffer->isZeroSized()) |
- return; |
dshwang
2014/03/10 18:23:31
Currently, when failing to create fbo, return here
|
- |
m_drawingBuffer->bind(); |
m_lostContextErrors.clear(); |