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