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 4212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4223 | 4223 |
4224 blink::WebLayer* WebGLRenderingContextBase::platformLayer() const | 4224 blink::WebLayer* WebGLRenderingContextBase::platformLayer() const |
4225 { | 4225 { |
4226 return isContextLost() ? 0 : m_drawingBuffer->platformLayer(); | 4226 return isContextLost() ? 0 : m_drawingBuffer->platformLayer(); |
4227 } | 4227 } |
4228 | 4228 |
4229 Extensions3DUtil* WebGLRenderingContextBase::extensionsUtil() | 4229 Extensions3DUtil* WebGLRenderingContextBase::extensionsUtil() |
4230 { | 4230 { |
4231 ASSERT(!isContextLost()); | 4231 ASSERT(!isContextLost()); |
4232 if (!m_extensionsUtil) | 4232 if (!m_extensionsUtil) |
4233 m_extensionsUtil = adoptPtr(new Extensions3DUtil(webContext())); | 4233 m_extensionsUtil = Extensions3DUtil::create(webContext()); |
4234 return m_extensionsUtil.get(); | 4234 return m_extensionsUtil.get(); |
4235 } | 4235 } |
4236 | 4236 |
4237 void WebGLRenderingContextBase::removeSharedObject(WebGLSharedObject* object) | 4237 void WebGLRenderingContextBase::removeSharedObject(WebGLSharedObject* object) |
4238 { | 4238 { |
4239 m_contextGroup->removeObject(object); | 4239 m_contextGroup->removeObject(object); |
4240 } | 4240 } |
4241 | 4241 |
4242 void WebGLRenderingContextBase::addSharedObject(WebGLSharedObject* object) | 4242 void WebGLRenderingContextBase::addSharedObject(WebGLSharedObject* object) |
4243 { | 4243 { |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 | 5437 |
5438 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) | 5438 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) |
5439 return; | 5439 return; |
5440 | 5440 |
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. | 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 m_drawingBuffer.clear(); | 5442 m_drawingBuffer.clear(); |
5443 | 5443 |
5444 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes->
attributes(canvas()->document().topDocument().url().string(), settings); | 5444 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)); | 5445 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); |
5446 RefPtr<DrawingBuffer> drawingBuffer; | 5446 RefPtr<DrawingBuffer> drawingBuffer; |
| 5447 // Even if a non-null WebGraphicsContext3D is created, until it's made curre
nt, it isn't known whether the context is still lost. |
5447 if (context) { | 5448 if (context) { |
5448 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad
optRef(new WebGLRenderingContextEvictionManager()); | 5449 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad
optRef(new WebGLRenderingContextEvictionManager()); |
5449 | 5450 |
5450 // Construct a new drawing buffer with the new WebGraphicsContext3D. | 5451 // Construct a new drawing buffer with the new WebGraphicsContext3D. |
5451 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p
reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; | 5452 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p
reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
5452 drawingBuffer = DrawingBuffer::create(context.release(), clampedCanvasSi
ze(), preserve, contextEvictionManager.release()); | 5453 drawingBuffer = DrawingBuffer::create(context.release(), clampedCanvasSi
ze(), preserve, contextEvictionManager.release()); |
5453 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i
s set to null. | 5454 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i
s set to null. |
5454 } | 5455 } |
5455 if (!drawingBuffer) { | 5456 if (!drawingBuffer) { |
5456 if (m_contextLostMode == RealLostContext) { | 5457 if (m_contextLostMode == RealLostContext) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 if (m_textureUnits[i].m_texture2DBinding | 5661 if (m_textureUnits[i].m_texture2DBinding |
5661 || m_textureUnits[i].m_textureCubeMapBinding) { | 5662 || m_textureUnits[i].m_textureCubeMapBinding) { |
5662 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5663 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5663 return; | 5664 return; |
5664 } | 5665 } |
5665 } | 5666 } |
5666 m_onePlusMaxNonDefaultTextureUnit = 0; | 5667 m_onePlusMaxNonDefaultTextureUnit = 0; |
5667 } | 5668 } |
5668 | 5669 |
5669 } // namespace WebCore | 5670 } // namespace WebCore |
OLD | NEW |