| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 unsigned long m_onePlusMaxNonDefaultTextureUnit; | 785 unsigned long m_onePlusMaxNonDefaultTextureUnit; |
| 786 | 786 |
| 787 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; | 787 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; |
| 788 | 788 |
| 789 enum ExtensionFlags { | 789 enum ExtensionFlags { |
| 790 ApprovedExtension = 0x00, | 790 ApprovedExtension = 0x00, |
| 791 // Extension that is behind the draft extensions runtime flag: | 791 // Extension that is behind the draft extensions runtime flag: |
| 792 DraftExtension = 0x01, | 792 DraftExtension = 0x01, |
| 793 }; | 793 }; |
| 794 | 794 |
| 795 class ExtensionTracker : public GarbageCollected<ExtensionTracker> { | 795 class ExtensionTracker : public GarbageCollected<ExtensionTracker>, |
| 796 public TraceWrapperBase { |
| 796 public: | 797 public: |
| 797 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) | 798 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) |
| 798 : m_draft(flags & DraftExtension), m_prefixes(prefixes) {} | 799 : m_draft(flags & DraftExtension), m_prefixes(prefixes) {} |
| 799 | 800 |
| 800 bool draft() const { return m_draft; } | 801 bool draft() const { return m_draft; } |
| 801 | 802 |
| 802 const char* const* prefixes() const; | 803 const char* const* prefixes() const; |
| 803 bool matchesNameWithPrefixes(const String&) const; | 804 bool matchesNameWithPrefixes(const String&) const; |
| 804 | 805 |
| 805 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0; | 806 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 | 852 |
| 852 WebGLExtension* getExtensionObjectIfAlreadyEnabled() override { | 853 WebGLExtension* getExtensionObjectIfAlreadyEnabled() override { |
| 853 return m_extension; | 854 return m_extension; |
| 854 } | 855 } |
| 855 | 856 |
| 856 DEFINE_INLINE_VIRTUAL_TRACE() { | 857 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 857 visitor->trace(m_extension); | 858 visitor->trace(m_extension); |
| 858 ExtensionTracker::trace(visitor); | 859 ExtensionTracker::trace(visitor); |
| 859 } | 860 } |
| 860 | 861 |
| 862 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { |
| 863 visitor->traceWrappers(m_extension); |
| 864 } |
| 865 |
| 861 private: | 866 private: |
| 862 TypedExtensionTracker(Member<T>& extensionField, | 867 TypedExtensionTracker(Member<T>& extensionField, |
| 863 ExtensionFlags flags, | 868 ExtensionFlags flags, |
| 864 const char* const* prefixes) | 869 const char* const* prefixes) |
| 865 : ExtensionTracker(flags, prefixes), m_extensionField(extensionField) {} | 870 : ExtensionTracker(flags, prefixes), |
| 871 m_extensionField(extensionField), |
| 872 m_extension(this, nullptr) {} |
| 866 | 873 |
| 867 GC_PLUGIN_IGNORE("http://crbug.com/519953") | 874 GC_PLUGIN_IGNORE("http://crbug.com/519953") |
| 868 Member<T>& m_extensionField; | 875 Member<T>& m_extensionField; |
| 869 // ExtensionTracker holds it's own reference to the extension to ensure | 876 // ExtensionTracker holds it's own reference to the extension to ensure |
| 870 // that it is not deleted before this object's destructor is called | 877 // that it is not deleted before this object's destructor is called |
| 871 Member<T> m_extension; | 878 TraceWrapperMember<T> m_extension; |
| 872 }; | 879 }; |
| 873 | 880 |
| 874 bool m_extensionEnabled[WebGLExtensionNameCount]; | 881 bool m_extensionEnabled[WebGLExtensionNameCount]; |
| 875 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions; | 882 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions; |
| 876 | 883 |
| 877 template <typename T> | 884 template <typename T> |
| 878 void registerExtension(Member<T>& extensionPtr, | 885 void registerExtension(Member<T>& extensionPtr, |
| 879 ExtensionFlags flags = ApprovedExtension, | 886 ExtensionFlags flags = ApprovedExtension, |
| 880 const char* const* prefixes = nullptr) { | 887 const char* const* prefixes = nullptr) { |
| 881 m_extensions.append(TraceWrapperMember<ExtensionTracker>( | 888 m_extensions.append(TraceWrapperMember<ExtensionTracker>( |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 context, | 1666 context, |
| 1660 context->is3d(), | 1667 context->is3d(), |
| 1661 context.is3d()); | 1668 context.is3d()); |
| 1662 | 1669 |
| 1663 } // namespace blink | 1670 } // namespace blink |
| 1664 | 1671 |
| 1665 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( | 1672 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( |
| 1666 blink::WebGLRenderingContextBase::TextureUnitState); | 1673 blink::WebGLRenderingContextBase::TextureUnitState); |
| 1667 | 1674 |
| 1668 #endif // WebGLRenderingContextBase_h | 1675 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |