Chromium Code Reviews| 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC , PrefixedExtension, webkitPrefix); | 617 registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC , PrefixedExtension, webkitPrefix); |
| 618 registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, PrefixedExtension, bothPrefixes); | 618 registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, PrefixedExtension, bothPrefixes); |
| 619 registerExtension<WebGLDepthTexture>(m_webglDepthTexture, PrefixedExtension, bothPrefixes); | 619 registerExtension<WebGLDepthTexture>(m_webglDepthTexture, PrefixedExtension, bothPrefixes); |
| 620 registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, b othPrefixes); | 620 registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, b othPrefixes); |
| 621 | 621 |
| 622 // Register draft extensions. | 622 // Register draft extensions. |
| 623 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); | 623 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); |
| 624 registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers, DraftExtension); | 624 registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers, DraftExtension); |
| 625 | 625 |
| 626 // Register privileged extensions. | 626 // Register privileged extensions. |
| 627 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, Privileg edExtension); | 627 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb ugRendererInfoExtension); |
|
Ken Russell (switch to Gerrit)
2013/10/29 23:00:17
Would it work to use the argument (PrivilegedExten
Zhenyao Mo
2013/10/29 23:05:52
That's what I did in the first try, but it will co
| |
| 628 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio n); | 628 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio n); |
| 629 } | 629 } |
| 630 | 630 |
| 631 void WebGLRenderingContext::initializeNewContext() | 631 void WebGLRenderingContext::initializeNewContext() |
| 632 { | 632 { |
| 633 ASSERT(!isContextLost()); | 633 ASSERT(!isContextLost()); |
| 634 m_needsUpdate = true; | 634 m_needsUpdate = true; |
| 635 m_markedCanvasDirty = false; | 635 m_markedCanvasDirty = false; |
| 636 m_activeTextureUnit = 0; | 636 m_activeTextureUnit = 0; |
| 637 m_packAlignment = 4; | 637 m_packAlignment = 4; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 m_isDepthStencilSupported = m_context->extensions()->isEnabled("GL_OES_packe d_depth_stencil"); | 721 m_isDepthStencilSupported = m_context->extensions()->isEnabled("GL_OES_packe d_depth_stencil"); |
| 722 } | 722 } |
| 723 | 723 |
| 724 bool WebGLRenderingContext::allowPrivilegedExtensions() const | 724 bool WebGLRenderingContext::allowPrivilegedExtensions() const |
| 725 { | 725 { |
| 726 if (Page* p = canvas()->document().page()) | 726 if (Page* p = canvas()->document().page()) |
| 727 return p->settings().privilegedWebGLExtensionsEnabled(); | 727 return p->settings().privilegedWebGLExtensionsEnabled(); |
| 728 return false; | 728 return false; |
| 729 } | 729 } |
| 730 | 730 |
| 731 bool WebGLRenderingContext::allowWebGLDebugRendererInfo() const | |
| 732 { | |
| 733 if (allowPrivilegedExtensions()) | |
| 734 return true; | |
| 735 Frame* frame = canvas()->document().frame(); | |
| 736 return frame && frame->loader().client()->allowWebGLDebugRendererInfo(); | |
| 737 } | |
| 738 | |
| 731 void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) | 739 void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) |
| 732 { | 740 { |
| 733 if (!m_compressedTextureFormats.contains(format)) | 741 if (!m_compressedTextureFormats.contains(format)) |
| 734 m_compressedTextureFormats.append(format); | 742 m_compressedTextureFormats.append(format); |
| 735 } | 743 } |
| 736 | 744 |
| 737 void WebGLRenderingContext::removeAllCompressedTextureFormats() | 745 void WebGLRenderingContext::removeAllCompressedTextureFormats() |
| 738 { | 746 { |
| 739 m_compressedTextureFormats.clear(); | 747 m_compressedTextureFormats.clear(); |
| 740 } | 748 } |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2170 } | 2178 } |
| 2171 | 2179 |
| 2172 PassRefPtr<WebGLExtension> WebGLRenderingContext::getExtension(const String& nam e) | 2180 PassRefPtr<WebGLExtension> WebGLRenderingContext::getExtension(const String& nam e) |
| 2173 { | 2181 { |
| 2174 if (isContextLost()) | 2182 if (isContextLost()) |
| 2175 return 0; | 2183 return 0; |
| 2176 | 2184 |
| 2177 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2185 for (size_t i = 0; i < m_extensions.size(); ++i) { |
| 2178 ExtensionTracker* tracker = m_extensions[i]; | 2186 ExtensionTracker* tracker = m_extensions[i]; |
| 2179 if (tracker->matchesNameWithPrefixes(name)) { | 2187 if (tracker->matchesNameWithPrefixes(name)) { |
| 2188 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInf o()) | |
| 2189 return 0; | |
| 2180 if (tracker->privileged() && !allowPrivilegedExtensions()) | 2190 if (tracker->privileged() && !allowPrivilegedExtensions()) |
| 2181 return 0; | 2191 return 0; |
| 2182 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtension sEnabled()) | 2192 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtension sEnabled()) |
| 2183 return 0; | 2193 return 0; |
| 2184 if (!tracker->supported(this)) | 2194 if (!tracker->supported(this)) |
| 2185 return 0; | 2195 return 0; |
| 2186 return tracker->getExtension(this); | 2196 return tracker->getExtension(this); |
| 2187 } | 2197 } |
| 2188 } | 2198 } |
| 2189 | 2199 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2623 } | 2633 } |
| 2624 | 2634 |
| 2625 Vector<String> WebGLRenderingContext::getSupportedExtensions() | 2635 Vector<String> WebGLRenderingContext::getSupportedExtensions() |
| 2626 { | 2636 { |
| 2627 Vector<String> result; | 2637 Vector<String> result; |
| 2628 if (isContextLost()) | 2638 if (isContextLost()) |
| 2629 return result; | 2639 return result; |
| 2630 | 2640 |
| 2631 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2641 for (size_t i = 0; i < m_extensions.size(); ++i) { |
| 2632 ExtensionTracker* tracker = m_extensions[i]; | 2642 ExtensionTracker* tracker = m_extensions[i]; |
| 2643 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInfo()) | |
| 2644 continue; | |
| 2633 if (tracker->privileged() && !allowPrivilegedExtensions()) | 2645 if (tracker->privileged() && !allowPrivilegedExtensions()) |
| 2634 continue; | 2646 continue; |
| 2635 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEna bled()) | 2647 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEna bled()) |
| 2636 continue; | 2648 continue; |
| 2637 if (tracker->supported(this)) | 2649 if (tracker->supported(this)) |
| 2638 result.append(String(tracker->prefixed() ? "WEBKIT_" : "") + tracke r->extensionName()); | 2650 result.append(String(tracker->prefixed() ? "WEBKIT_" : "") + tracke r->extensionName()); |
| 2639 } | 2651 } |
| 2640 | 2652 |
| 2641 return result; | 2653 return result; |
| 2642 } | 2654 } |
| (...skipping 2972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5615 if (m_textureUnits[i].m_texture2DBinding | 5627 if (m_textureUnits[i].m_texture2DBinding |
| 5616 || m_textureUnits[i].m_textureCubeMapBinding) { | 5628 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5617 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5629 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5618 return; | 5630 return; |
| 5619 } | 5631 } |
| 5620 } | 5632 } |
| 5621 m_onePlusMaxNonDefaultTextureUnit = 0; | 5633 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5622 } | 5634 } |
| 5623 | 5635 |
| 5624 } // namespace WebCore | 5636 } // namespace WebCore |
| OLD | NEW |