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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "core/loader/FrameLoaderClient.h" | 53 #include "core/loader/FrameLoaderClient.h" |
54 #include "core/frame/Settings.h" | 54 #include "core/frame/Settings.h" |
55 #include "core/rendering/RenderBox.h" | 55 #include "core/rendering/RenderBox.h" |
56 #include "platform/CheckedInt.h" | 56 #include "platform/CheckedInt.h" |
57 #include "platform/NotImplemented.h" | 57 #include "platform/NotImplemented.h" |
58 #include "platform/graphics/gpu/DrawingBuffer.h" | 58 #include "platform/graphics/gpu/DrawingBuffer.h" |
59 #include "public/platform/Platform.h" | 59 #include "public/platform/Platform.h" |
60 | 60 |
61 namespace WebCore { | 61 namespace WebCore { |
62 | 62 |
63 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen
t* canvas, WebGLContextAttributes* attrs) | 63 PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTML
CanvasElement* canvas, WebGLContextAttributes* attrs) |
64 { | 64 { |
65 Document& document = canvas->document(); | 65 Document& document = canvas->document(); |
66 LocalFrame* frame = document.frame(); | 66 LocalFrame* frame = document.frame(); |
67 if (!frame) { | 67 if (!frame) { |
68 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 68 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
69 return nullptr; | 69 return nullptr; |
70 } | 70 } |
71 Settings* settings = frame->settings(); | 71 Settings* settings = frame->settings(); |
72 | 72 |
73 // The FrameLoaderClient might block creation of a new WebGL context despite
the page settings; in | 73 // The FrameLoaderClient might block creation of a new WebGL context despite
the page settings; in |
(...skipping 13 matching lines...) Expand all Loading... |
87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); | 87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); |
88 if (!context || !context->makeContextCurrent()) { | 88 if (!context || !context->makeContextCurrent()) { |
89 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 89 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
90 return nullptr; | 90 return nullptr; |
91 } | 91 } |
92 | 92 |
93 Extensions3DUtil extensionsUtil(context.get()); | 93 Extensions3DUtil extensionsUtil(context.get()); |
94 if (extensionsUtil.supportsExtension("GL_EXT_debug_marker")) | 94 if (extensionsUtil.supportsExtension("GL_EXT_debug_marker")) |
95 context->pushGroupMarkerEXT("WebGLRenderingContext"); | 95 context->pushGroupMarkerEXT("WebGLRenderingContext"); |
96 | 96 |
97 OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRendering
Context(canvas, context.release(), attrs)); | 97 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN
oop(new WebGLRenderingContext(canvas, context.release(), attrs)); |
98 renderingContext->registerContextExtensions(); | 98 renderingContext->registerContextExtensions(); |
99 renderingContext->suspendIfNeeded(); | 99 renderingContext->suspendIfNeeded(); |
100 | 100 |
101 if (!renderingContext->m_drawingBuffer) { | 101 if (!renderingContext->m_drawingBuffer) { |
102 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 102 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
103 return nullptr; | 103 return nullptr; |
104 } | 104 } |
105 | 105 |
106 return renderingContext.release(); | 106 return renderingContext.release(); |
107 } | 107 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); | 143 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); |
144 registerExtension<EXTShaderTextureLOD>(m_extShaderTextureLOD, DraftExtension
); | 144 registerExtension<EXTShaderTextureLOD>(m_extShaderTextureLOD, DraftExtension
); |
145 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1,
DraftExtension); | 145 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1,
DraftExtension); |
146 | 146 |
147 // Register privileged extensions. | 147 // Register privileged extensions. |
148 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb
ugRendererInfoExtension); | 148 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb
ugRendererInfoExtension); |
149 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio
n); | 149 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio
n); |
150 } | 150 } |
151 | 151 |
152 } // namespace WebCore | 152 } // namespace WebCore |
OLD | NEW |