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 4698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5432 LocalFrame* frame = canvas()->document().frame(); | 5433 LocalFrame* frame = canvas()->document().frame(); |
5433 if (!frame) | 5434 if (!frame) |
5434 return; | 5435 return; |
5435 | 5436 |
5436 Settings* settings = frame->settings(); | 5437 Settings* settings = frame->settings(); |
5437 | 5438 |
5438 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) | 5439 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) |
5439 return; | 5440 return; |
5440 | 5441 |
5441 // 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. | 5442 // 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. |
5442 m_drawingBuffer.clear(); | 5443 if (m_drawingBuffer) { |
| 5444 m_drawingBuffer->beginDestruction(); |
| 5445 m_drawingBuffer.clear(); |
| 5446 } |
5443 | 5447 |
5444 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes->
attributes(canvas()->document().topDocument().url().string(), settings); | 5448 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes->
attributes(canvas()->document().topDocument().url().string(), settings); |
5445 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); | 5449 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); |
5446 RefPtr<DrawingBuffer> drawingBuffer; | 5450 RefPtr<DrawingBuffer> drawingBuffer; |
5447 if (context) { | 5451 if (context) { |
5448 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad
optRef(new WebGLRenderingContextEvictionManager()); | 5452 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad
optRef(new WebGLRenderingContextEvictionManager()); |
5449 | 5453 |
5450 // Construct a new drawing buffer with the new WebGraphicsContext3D. | 5454 // Construct a new drawing buffer with the new WebGraphicsContext3D. |
5451 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p
reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; | 5455 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p
reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
5452 drawingBuffer = DrawingBuffer::create(context.release(), clampedCanvasSi
ze(), preserve, contextEvictionManager.release()); | 5456 drawingBuffer = DrawingBuffer::create(context.release(), clampedCanvasSi
ze(), preserve, contextEvictionManager.release()); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 if (m_textureUnits[i].m_texture2DBinding | 5664 if (m_textureUnits[i].m_texture2DBinding |
5661 || m_textureUnits[i].m_textureCubeMapBinding) { | 5665 || m_textureUnits[i].m_textureCubeMapBinding) { |
5662 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5666 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5663 return; | 5667 return; |
5664 } | 5668 } |
5665 } | 5669 } |
5666 m_onePlusMaxNonDefaultTextureUnit = 0; | 5670 m_onePlusMaxNonDefaultTextureUnit = 0; |
5667 } | 5671 } |
5668 | 5672 |
5669 } // namespace WebCore | 5673 } // namespace WebCore |
OLD | NEW |