OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 714 |
715 if (!m_drawingBuffer) | 715 if (!m_drawingBuffer) |
716 return; | 716 return; |
717 | 717 |
718 m_extensionsUtil.clear(); | 718 m_extensionsUtil.clear(); |
719 | 719 |
720 webContext()->setContextLostCallback(0); | 720 webContext()->setContextLostCallback(0); |
721 webContext()->setErrorMessageCallback(0); | 721 webContext()->setErrorMessageCallback(0); |
722 | 722 |
723 ASSERT(m_drawingBuffer); | 723 ASSERT(m_drawingBuffer); |
| 724 m_drawingBuffer->beginDestruction(); |
724 m_drawingBuffer.clear(); | 725 m_drawingBuffer.clear(); |
725 } | 726 } |
726 | 727 |
727 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) | 728 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) |
728 { | 729 { |
729 if (m_framebufferBinding || isContextLost()) | 730 if (m_framebufferBinding || isContextLost()) |
730 return; | 731 return; |
731 | 732 |
732 m_drawingBuffer->markContentsChanged(); | 733 m_drawingBuffer->markContentsChanged(); |
733 | 734 |
(...skipping 4631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5365 LocalFrame* frame = canvas()->document().frame(); | 5366 LocalFrame* frame = canvas()->document().frame(); |
5366 if (!frame) | 5367 if (!frame) |
5367 return; | 5368 return; |
5368 | 5369 |
5369 Settings* settings = frame->settings(); | 5370 Settings* settings = frame->settings(); |
5370 | 5371 |
5371 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) | 5372 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) |
5372 return; | 5373 return; |
5373 | 5374 |
5374 // If the context was lost due to RealLostContext, we need to destroy the ol
d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou
gh. | 5375 // If the context was lost due to RealLostContext, we need to destroy the ol
d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou
gh. |
5375 m_drawingBuffer.clear(); | 5376 if (m_drawingBuffer) { |
| 5377 m_drawingBuffer->beginDestruction(); |
| 5378 m_drawingBuffer.clear(); |
| 5379 } |
5376 | 5380 |
5377 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes->
attributes(canvas()->document().topDocument().url().string(), settings); | 5381 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes->
attributes(canvas()->document().topDocument().url().string(), settings); |
5378 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); | 5382 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); |
5379 RefPtr<DrawingBuffer> drawingBuffer; | 5383 RefPtr<DrawingBuffer> drawingBuffer; |
5380 if (context) { | 5384 if (context) { |
5381 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad
optRef(new WebGLRenderingContextEvictionManager()); | 5385 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad
optRef(new WebGLRenderingContextEvictionManager()); |
5382 | 5386 |
5383 // Construct a new drawing buffer with the new WebGraphicsContext3D. | 5387 // Construct a new drawing buffer with the new WebGraphicsContext3D. |
5384 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p
reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; | 5388 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p
reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
5385 drawingBuffer = DrawingBuffer::create(context.release(), clampedCanvasSi
ze(), preserve, contextEvictionManager.release()); | 5389 drawingBuffer = DrawingBuffer::create(context.release(), clampedCanvasSi
ze(), preserve, contextEvictionManager.release()); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5593 if (m_textureUnits[i].m_texture2DBinding | 5597 if (m_textureUnits[i].m_texture2DBinding |
5594 || m_textureUnits[i].m_textureCubeMapBinding) { | 5598 || m_textureUnits[i].m_textureCubeMapBinding) { |
5595 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5599 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5596 return; | 5600 return; |
5597 } | 5601 } |
5598 } | 5602 } |
5599 m_onePlusMaxNonDefaultTextureUnit = 0; | 5603 m_onePlusMaxNonDefaultTextureUnit = 0; |
5600 } | 5604 } |
5601 | 5605 |
5602 } // namespace WebCore | 5606 } // namespace WebCore |
OLD | NEW |