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 15 matching lines...) Expand all Loading... |
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 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); | 93 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); |
94 if (!extensionsUtil) | 94 if (!extensionsUtil) |
95 return nullptr; | 95 return nullptr; |
96 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) | 96 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) |
97 context->pushGroupMarkerEXT("WebGLRenderingContext"); | 97 context->pushGroupMarkerEXT("WebGLRenderingContext"); |
98 | 98 |
99 OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRendering
Context(canvas, context.release(), attrs)); | 99 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN
oop(new WebGLRenderingContext(canvas, context.release(), attrs)); |
100 renderingContext->registerContextExtensions(); | 100 renderingContext->registerContextExtensions(); |
101 renderingContext->suspendIfNeeded(); | 101 renderingContext->suspendIfNeeded(); |
102 | 102 |
103 if (!renderingContext->m_drawingBuffer) { | 103 if (!renderingContext->m_drawingBuffer) { |
104 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 104 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
105 return nullptr; | 105 return nullptr; |
106 } | 106 } |
107 | 107 |
108 return renderingContext.release(); | 108 return renderingContext.release(); |
109 } | 109 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); | 145 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); |
146 registerExtension<EXTShaderTextureLOD>(m_extShaderTextureLOD, DraftExtension
); | 146 registerExtension<EXTShaderTextureLOD>(m_extShaderTextureLOD, DraftExtension
); |
147 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1,
DraftExtension); | 147 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1,
DraftExtension); |
148 | 148 |
149 // Register privileged extensions. | 149 // Register privileged extensions. |
150 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb
ugRendererInfoExtension); | 150 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb
ugRendererInfoExtension); |
151 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio
n); | 151 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio
n); |
152 } | 152 } |
153 | 153 |
154 } // namespace WebCore | 154 } // namespace WebCore |
OLD | NEW |