Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp

Issue 2451943002: Remove runtime flag 'UnsafeES3APIs' from blink webgl (Closed)
Patch Set: Addressed kbr@'s feedback, and rebased the code Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC ontextOrWebGL2RenderingContext.h" 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC ontextOrWebGL2RenderingContext.h"
8 #include "bindings/modules/v8/RenderingContext.h" 8 #include "bindings/modules/v8/RenderingContext.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 20 matching lines...) Expand all
31 #include "public/platform/Platform.h" 31 #include "public/platform/Platform.h"
32 #include "public/platform/WebGraphicsContext3DProvider.h" 32 #include "public/platform/WebGraphicsContext3DProvider.h"
33 #include <memory> 33 #include <memory>
34 34
35 namespace blink { 35 namespace blink {
36 36
37 CanvasRenderingContext* WebGL2RenderingContext::Factory::create( 37 CanvasRenderingContext* WebGL2RenderingContext::Factory::create(
38 HTMLCanvasElement* canvas, 38 HTMLCanvasElement* canvas,
39 const CanvasContextCreationAttributes& attrs, 39 const CanvasContextCreationAttributes& attrs,
40 Document&) { 40 Document&) {
41 if (!RuntimeEnabledFeatures::unsafeES3APIsEnabled()) { 41 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(
42 createWebGraphicsContext3DProvider(canvas, attrs, 2));
43 if (!contextProvider) {
42 canvas->dispatchEvent(WebGLContextEvent::create( 44 canvas->dispatchEvent(WebGLContextEvent::create(
43 EventTypeNames::webglcontextcreationerror, false, true, 45 EventTypeNames::webglcontextcreationerror, false, true,
44 "Creation of WebGL2 contexts disabled.")); 46 "Failed to create a WebGL2 context."));
45 return nullptr; 47 return nullptr;
46 } 48 }
47
48 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(
49 createWebGraphicsContext3DProvider(canvas, attrs, 2));
50 if (!contextProvider)
51 return nullptr;
52 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); 49 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL();
53 std::unique_ptr<Extensions3DUtil> extensionsUtil = 50 std::unique_ptr<Extensions3DUtil> extensionsUtil =
54 Extensions3DUtil::create(gl); 51 Extensions3DUtil::create(gl);
55 if (!extensionsUtil) 52 if (!extensionsUtil)
56 return nullptr; 53 return nullptr;
57 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { 54 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) {
58 String contextLabel( 55 String contextLabel(
59 String::format("WebGL2RenderingContext-%p", contextProvider.get())); 56 String::format("WebGL2RenderingContext-%p", contextProvider.get()));
60 gl->PushGroupMarkerEXT(0, contextLabel.ascii().data()); 57 gl->PushGroupMarkerEXT(0, contextLabel.ascii().data());
61 } 58 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 visitor->traceWrappers(m_webglCompressedTexturePVRTC); 158 visitor->traceWrappers(m_webglCompressedTexturePVRTC);
162 visitor->traceWrappers(m_webglCompressedTextureS3TC); 159 visitor->traceWrappers(m_webglCompressedTextureS3TC);
163 visitor->traceWrappers(m_webglCompressedTextureS3TCsRGB); 160 visitor->traceWrappers(m_webglCompressedTextureS3TCsRGB);
164 visitor->traceWrappers(m_webglDebugRendererInfo); 161 visitor->traceWrappers(m_webglDebugRendererInfo);
165 visitor->traceWrappers(m_webglDebugShaders); 162 visitor->traceWrappers(m_webglDebugShaders);
166 visitor->traceWrappers(m_webglLoseContext); 163 visitor->traceWrappers(m_webglLoseContext);
167 WebGL2RenderingContextBase::traceWrappers(visitor); 164 WebGL2RenderingContextBase::traceWrappers(visitor);
168 } 165 }
169 166
170 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698