| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "core/loader/FrameLoaderClient.h" | 58 #include "core/loader/FrameLoaderClient.h" |
| 59 #include "platform/CheckedInt.h" | 59 #include "platform/CheckedInt.h" |
| 60 #include "platform/graphics/gpu/DrawingBuffer.h" | 60 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 61 #include "public/platform/Platform.h" | 61 #include "public/platform/Platform.h" |
| 62 | 62 |
| 63 namespace blink { | 63 namespace blink { |
| 64 | 64 |
| 65 PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTML
CanvasElement* canvas, const CanvasContextCreationAttributes& attrs) | 65 PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTML
CanvasElement* canvas, const CanvasContextCreationAttributes& attrs) |
| 66 { | 66 { |
| 67 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 67 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); |
| 68 OwnPtr<blink::WebGraphicsContext3D> context(createWebGraphicsContext3D(canva
s, attributes, 1)); | 68 OwnPtr<WebGraphicsContext3D> context(createWebGraphicsContext3D(canvas, attr
ibutes, 1)); |
| 69 if (!context) | 69 if (!context) |
| 70 return nullptr; | 70 return nullptr; |
| 71 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); | 71 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); |
| 72 if (!extensionsUtil) | 72 if (!extensionsUtil) |
| 73 return nullptr; | 73 return nullptr; |
| 74 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { | 74 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { |
| 75 String contextLabel(String::format("WebGLRenderingContext-%p", context.g
et())); | 75 String contextLabel(String::format("WebGLRenderingContext-%p", context.g
et())); |
| 76 context->pushGroupMarkerEXT(contextLabel.ascii().data()); | 76 context->pushGroupMarkerEXT(contextLabel.ascii().data()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN
oop(new WebGLRenderingContext(canvas, context.release(), attributes)); | 79 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN
oop(new WebGLRenderingContext(canvas, context.release(), attributes)); |
| 80 renderingContext->initializeNewContext(); | 80 renderingContext->initializeNewContext(); |
| 81 renderingContext->registerContextExtensions(); | 81 renderingContext->registerContextExtensions(); |
| 82 | 82 |
| 83 if (!renderingContext->drawingBuffer()) { | 83 if (!renderingContext->drawingBuffer()) { |
| 84 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 84 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
| 85 return nullptr; | 85 return nullptr; |
| 86 } | 86 } |
| 87 | 87 |
| 88 return renderingContext.release(); | 88 return renderingContext.release(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa
ssOwnPtr<blink::WebGraphicsContext3D> context, const WebGLContextAttributes& req
uestedAttributes) | 91 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa
ssOwnPtr<WebGraphicsContext3D> context, const WebGLContextAttributes& requestedA
ttributes) |
| 92 : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes) | 92 : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes) |
| 93 { | 93 { |
| 94 } | 94 } |
| 95 | 95 |
| 96 WebGLRenderingContext::~WebGLRenderingContext() | 96 WebGLRenderingContext::~WebGLRenderingContext() |
| 97 { | 97 { |
| 98 } | 98 } |
| 99 | 99 |
| 100 void WebGLRenderingContext::registerContextExtensions() | 100 void WebGLRenderingContext::registerContextExtensions() |
| 101 { | 101 { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 visitor->trace(m_webglDrawBuffers); | 149 visitor->trace(m_webglDrawBuffers); |
| 150 visitor->trace(m_webglCompressedTextureATC); | 150 visitor->trace(m_webglCompressedTextureATC); |
| 151 visitor->trace(m_webglCompressedTextureETC1); | 151 visitor->trace(m_webglCompressedTextureETC1); |
| 152 visitor->trace(m_webglCompressedTexturePVRTC); | 152 visitor->trace(m_webglCompressedTexturePVRTC); |
| 153 visitor->trace(m_webglCompressedTextureS3TC); | 153 visitor->trace(m_webglCompressedTextureS3TC); |
| 154 visitor->trace(m_webglDepthTexture); | 154 visitor->trace(m_webglDepthTexture); |
| 155 WebGLRenderingContextBase::trace(visitor); | 155 WebGLRenderingContextBase::trace(visitor); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |