| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 RefPtr<WebGLCompressedTextureATC> m_webglCompressedTextureATC; | 532 RefPtr<WebGLCompressedTextureATC> m_webglCompressedTextureATC; |
| 533 RefPtr<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC; | 533 RefPtr<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC; |
| 534 RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; | 534 RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; |
| 535 RefPtr<WebGLDepthTexture> m_webglDepthTexture; | 535 RefPtr<WebGLDepthTexture> m_webglDepthTexture; |
| 536 | 536 |
| 537 enum ExtensionFlags { | 537 enum ExtensionFlags { |
| 538 ApprovedExtension = 0x00, | 538 ApprovedExtension = 0x00, |
| 539 DraftExtension = 0x01, | 539 DraftExtension = 0x01, |
| 540 PrivilegedExtension = 0x02, | 540 PrivilegedExtension = 0x02, |
| 541 PrefixedExtension = 0x04, | 541 PrefixedExtension = 0x04, |
| 542 WebGLDebugRendererInfoExtension = 0x08, |
| 542 }; | 543 }; |
| 543 | 544 |
| 544 class ExtensionTracker { | 545 class ExtensionTracker { |
| 545 public: | 546 public: |
| 546 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) | 547 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) |
| 547 : m_privileged(flags & PrivilegedExtension) | 548 : m_privileged(flags & PrivilegedExtension) |
| 548 , m_draft(flags & DraftExtension) | 549 , m_draft(flags & DraftExtension) |
| 549 , m_prefixed(flags & PrefixedExtension) | 550 , m_prefixed(flags & PrefixedExtension) |
| 550 , m_prefixes(prefixes) | 551 , m_prefixes(prefixes) |
| 552 , m_webglDebugRendererInfo(flags & WebGLDebugRendererInfoExtension) |
| 551 { | 553 { |
| 552 } | 554 } |
| 553 | 555 |
| 554 virtual ~ExtensionTracker() | 556 virtual ~ExtensionTracker() |
| 555 { | 557 { |
| 556 } | 558 } |
| 557 | 559 |
| 558 bool prefixed() const | 560 bool prefixed() const |
| 559 { | 561 { |
| 560 return m_prefixed; | 562 return m_prefixed; |
| 561 } | 563 } |
| 562 | 564 |
| 563 bool privileged() const | 565 bool privileged() const |
| 564 { | 566 { |
| 565 return m_privileged; | 567 return m_privileged; |
| 566 } | 568 } |
| 567 | 569 |
| 568 bool draft() const | 570 bool draft() const |
| 569 { | 571 { |
| 570 return m_draft; | 572 return m_draft; |
| 571 } | 573 } |
| 572 | 574 |
| 575 bool webglDebugRendererInfo() const |
| 576 { |
| 577 return m_webglDebugRendererInfo; |
| 578 } |
| 579 |
| 573 bool matchesNameWithPrefixes(const String&) const; | 580 bool matchesNameWithPrefixes(const String&) const; |
| 574 | 581 |
| 575 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContext*)
const = 0; | 582 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContext*)
const = 0; |
| 576 virtual bool supported(WebGLRenderingContext*) const = 0; | 583 virtual bool supported(WebGLRenderingContext*) const = 0; |
| 577 virtual const char* extensionName() const = 0; | 584 virtual const char* extensionName() const = 0; |
| 578 virtual void loseExtension() = 0; | 585 virtual void loseExtension() = 0; |
| 579 | 586 |
| 580 private: | 587 private: |
| 581 bool m_privileged; | 588 bool m_privileged; |
| 582 bool m_draft; | 589 bool m_draft; |
| 583 bool m_prefixed; | 590 bool m_prefixed; |
| 591 bool m_webglDebugRendererInfo; |
| 584 const char* const* m_prefixes; | 592 const char* const* m_prefixes; |
| 585 }; | 593 }; |
| 586 | 594 |
| 587 template <typename T> | 595 template <typename T> |
| 588 class TypedExtensionTracker : public ExtensionTracker { | 596 class TypedExtensionTracker : public ExtensionTracker { |
| 589 public: | 597 public: |
| 590 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c
onst char* const* prefixes) | 598 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c
onst char* const* prefixes) |
| 591 : ExtensionTracker(flags, prefixes) | 599 : ExtensionTracker(flags, prefixes) |
| 592 , m_extensionField(extensionField) | 600 , m_extensionField(extensionField) |
| 593 { | 601 { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 bool checkObjectToBeBound(const char* functionName, WebGLObject*, bool& dele
ted); | 861 bool checkObjectToBeBound(const char* functionName, WebGLObject*, bool& dele
ted); |
| 854 | 862 |
| 855 void dispatchContextLostEvent(Timer<WebGLRenderingContext>*); | 863 void dispatchContextLostEvent(Timer<WebGLRenderingContext>*); |
| 856 // Helper for restoration after context lost. | 864 // Helper for restoration after context lost. |
| 857 void maybeRestoreContext(Timer<WebGLRenderingContext>*); | 865 void maybeRestoreContext(Timer<WebGLRenderingContext>*); |
| 858 | 866 |
| 859 // Determine if we are running privileged code in the browser, for example, | 867 // Determine if we are running privileged code in the browser, for example, |
| 860 // a Safari or Chrome extension. | 868 // a Safari or Chrome extension. |
| 861 bool allowPrivilegedExtensions() const; | 869 bool allowPrivilegedExtensions() const; |
| 862 | 870 |
| 871 // Determine if WEBGL_debug_renderer_info extension is enabled. For the |
| 872 // moment it can be enabled either through a chromium finch experiment |
| 873 // or for privileged code in the browser. |
| 874 bool allowWebGLDebugRendererInfo() const; |
| 875 |
| 863 enum ConsoleDisplayPreference { | 876 enum ConsoleDisplayPreference { |
| 864 DisplayInConsole, | 877 DisplayInConsole, |
| 865 DontDisplayInConsole | 878 DontDisplayInConsole |
| 866 }; | 879 }; |
| 867 | 880 |
| 868 // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message | 881 // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message |
| 869 // to the JavaScript console. | 882 // to the JavaScript console. |
| 870 void synthesizeGLError(GC3Denum, const char* functionName, const char* descr
iption, ConsoleDisplayPreference = DisplayInConsole); | 883 void synthesizeGLError(GC3Denum, const char* functionName, const char* descr
iption, ConsoleDisplayPreference = DisplayInConsole); |
| 871 void emitGLWarning(const char* function, const char* reason); | 884 void emitGLWarning(const char* function, const char* reason); |
| 872 | 885 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 static void forciblyLoseOldestContext(const String& reason); | 922 static void forciblyLoseOldestContext(const String& reason); |
| 910 // Return the least recently used context's position in the active context v
ector. | 923 // Return the least recently used context's position in the active context v
ector. |
| 911 // If the vector is empty, return the maximum allowed active context number. | 924 // If the vector is empty, return the maximum allowed active context number. |
| 912 static size_t oldestContextIndex(); | 925 static size_t oldestContextIndex(); |
| 913 static IntSize oldestContextSize(); | 926 static IntSize oldestContextSize(); |
| 914 }; | 927 }; |
| 915 | 928 |
| 916 } // namespace WebCore | 929 } // namespace WebCore |
| 917 | 930 |
| 918 #endif | 931 #endif |
| OLD | NEW |