| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGL2RenderingContext.h" | 5 #include "modules/webgl/WebGL2RenderingContext.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/loader/FrameLoader.h" | 9 #include "core/loader/FrameLoader.h" |
| 10 #include "core/loader/FrameLoaderClient.h" | 10 #include "core/loader/FrameLoaderClient.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "modules/webgl/WebGLContextAttributeHelpers.h" | 21 #include "modules/webgl/WebGLContextAttributeHelpers.h" |
| 22 #include "modules/webgl/WebGLContextEvent.h" | 22 #include "modules/webgl/WebGLContextEvent.h" |
| 23 #include "modules/webgl/WebGLDebugRendererInfo.h" | 23 #include "modules/webgl/WebGLDebugRendererInfo.h" |
| 24 #include "modules/webgl/WebGLDebugShaders.h" | 24 #include "modules/webgl/WebGLDebugShaders.h" |
| 25 #include "modules/webgl/WebGLLoseContext.h" | 25 #include "modules/webgl/WebGLLoseContext.h" |
| 26 #include "platform/graphics/gpu/DrawingBuffer.h" | 26 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 27 #include "public/platform/Platform.h" | 27 #include "public/platform/Platform.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 PassOwnPtrWillBeRawPtr<CanvasRenderingContext> WebGL2RenderingContext::Factory::
create(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs,
Document&) | 31 RawPtr<CanvasRenderingContext> WebGL2RenderingContext::Factory::create(HTMLCanva
sElement* canvas, const CanvasContextCreationAttributes& attrs, Document&) |
| 32 { | 32 { |
| 33 if (!RuntimeEnabledFeatures::unsafeES3APIsEnabled()) { | 33 if (!RuntimeEnabledFeatures::unsafeES3APIsEnabled()) { |
| 34 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Creation of WebGL2 contexts disabled.")); | 34 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Creation of WebGL2 contexts disabled.")); |
| 35 return nullptr; | 35 return nullptr; |
| 36 } | 36 } |
| 37 | 37 |
| 38 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 38 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); |
| 39 OwnPtr<WebGraphicsContext3D> context(createWebGraphicsContext3D(canvas, attr
ibutes, 2)); | 39 OwnPtr<WebGraphicsContext3D> context(createWebGraphicsContext3D(canvas, attr
ibutes, 2)); |
| 40 if (!context) | 40 if (!context) |
| 41 return nullptr; | 41 return nullptr; |
| 42 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); | 42 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); |
| 43 if (!extensionsUtil) | 43 if (!extensionsUtil) |
| 44 return nullptr; | 44 return nullptr; |
| 45 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { | 45 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { |
| 46 String contextLabel(String::format("WebGL2RenderingContext-%p", context.
get())); | 46 String contextLabel(String::format("WebGL2RenderingContext-%p", context.
get())); |
| 47 context->pushGroupMarkerEXT(contextLabel.ascii().data()); | 47 context->pushGroupMarkerEXT(contextLabel.ascii().data()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 OwnPtrWillBeRawPtr<WebGL2RenderingContext> renderingContext = adoptPtrWillBe
Noop(new WebGL2RenderingContext(canvas, context.release(), attributes)); | 50 RawPtr<WebGL2RenderingContext> renderingContext = (new WebGL2RenderingContex
t(canvas, context.release(), attributes)); |
| 51 | 51 |
| 52 if (!renderingContext->drawingBuffer()) { | 52 if (!renderingContext->drawingBuffer()) { |
| 53 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL2 context.")); | 53 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL2 context.")); |
| 54 return nullptr; | 54 return nullptr; |
| 55 } | 55 } |
| 56 | 56 |
| 57 renderingContext->initializeNewContext(); | 57 renderingContext->initializeNewContext(); |
| 58 renderingContext->registerContextExtensions(); | 58 renderingContext->registerContextExtensions(); |
| 59 | 59 |
| 60 return renderingContext.release(); | 60 return renderingContext.release(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 visitor->trace(m_webglCompressedTextureETC1); | 105 visitor->trace(m_webglCompressedTextureETC1); |
| 106 visitor->trace(m_webglCompressedTexturePVRTC); | 106 visitor->trace(m_webglCompressedTexturePVRTC); |
| 107 visitor->trace(m_webglCompressedTextureS3TC); | 107 visitor->trace(m_webglCompressedTextureS3TC); |
| 108 visitor->trace(m_webglDebugRendererInfo); | 108 visitor->trace(m_webglDebugRendererInfo); |
| 109 visitor->trace(m_webglDebugShaders); | 109 visitor->trace(m_webglDebugShaders); |
| 110 visitor->trace(m_webglLoseContext); | 110 visitor->trace(m_webglLoseContext); |
| 111 WebGL2RenderingContextBase::trace(visitor); | 111 WebGL2RenderingContextBase::trace(visitor); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |