| 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 unsigned long m_onePlusMaxNonDefaultTextureUnit; | 799 unsigned long m_onePlusMaxNonDefaultTextureUnit; |
| 800 | 800 |
| 801 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; | 801 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; |
| 802 | 802 |
| 803 enum ExtensionFlags { | 803 enum ExtensionFlags { |
| 804 ApprovedExtension = 0x00, | 804 ApprovedExtension = 0x00, |
| 805 // Extension that is behind the draft extensions runtime flag: | 805 // Extension that is behind the draft extensions runtime flag: |
| 806 DraftExtension = 0x01, | 806 DraftExtension = 0x01, |
| 807 }; | 807 }; |
| 808 | 808 |
| 809 class ExtensionTracker : public GarbageCollected<ExtensionTracker>, | 809 class ExtensionTracker : public GarbageCollected<ExtensionTracker> { |
| 810 public TraceWrapperBase { | |
| 811 public: | 810 public: |
| 812 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) | 811 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) |
| 813 : m_draft(flags & DraftExtension), m_prefixes(prefixes) {} | 812 : m_draft(flags & DraftExtension), m_prefixes(prefixes) {} |
| 814 | 813 |
| 815 bool draft() const { return m_draft; } | 814 bool draft() const { return m_draft; } |
| 816 | 815 |
| 817 const char* const* prefixes() const; | 816 const char* const* prefixes() const; |
| 818 bool matchesNameWithPrefixes(const String&) const; | 817 bool matchesNameWithPrefixes(const String&) const; |
| 819 | 818 |
| 820 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0; | 819 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 865 |
| 867 WebGLExtension* getExtensionObjectIfAlreadyEnabled() override { | 866 WebGLExtension* getExtensionObjectIfAlreadyEnabled() override { |
| 868 return m_extension; | 867 return m_extension; |
| 869 } | 868 } |
| 870 | 869 |
| 871 DEFINE_INLINE_VIRTUAL_TRACE() { | 870 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 872 visitor->trace(m_extension); | 871 visitor->trace(m_extension); |
| 873 ExtensionTracker::trace(visitor); | 872 ExtensionTracker::trace(visitor); |
| 874 } | 873 } |
| 875 | 874 |
| 876 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { | |
| 877 visitor->traceWrappers(m_extension); | |
| 878 } | |
| 879 | |
| 880 private: | 875 private: |
| 881 TypedExtensionTracker(Member<T>& extensionField, | 876 TypedExtensionTracker(Member<T>& extensionField, |
| 882 ExtensionFlags flags, | 877 ExtensionFlags flags, |
| 883 const char* const* prefixes) | 878 const char* const* prefixes) |
| 884 : ExtensionTracker(flags, prefixes), | 879 : ExtensionTracker(flags, prefixes), m_extensionField(extensionField) {} |
| 885 m_extensionField(extensionField), | |
| 886 m_extension(this, nullptr) {} | |
| 887 | 880 |
| 888 GC_PLUGIN_IGNORE("http://crbug.com/519953") | 881 GC_PLUGIN_IGNORE("http://crbug.com/519953") |
| 889 Member<T>& m_extensionField; | 882 Member<T>& m_extensionField; |
| 890 // ExtensionTracker holds it's own reference to the extension to ensure | 883 // ExtensionTracker holds it's own reference to the extension to ensure |
| 891 // that it is not deleted before this object's destructor is called | 884 // that it is not deleted before this object's destructor is called |
| 892 TraceWrapperMember<T> m_extension; | 885 Member<T> m_extension; |
| 893 }; | 886 }; |
| 894 | 887 |
| 895 bool m_extensionEnabled[WebGLExtensionNameCount]; | 888 bool m_extensionEnabled[WebGLExtensionNameCount]; |
| 896 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions; | 889 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions; |
| 897 | 890 |
| 898 template <typename T> | 891 template <typename T> |
| 899 void registerExtension(Member<T>& extensionPtr, | 892 void registerExtension(Member<T>& extensionPtr, |
| 900 ExtensionFlags flags = ApprovedExtension, | 893 ExtensionFlags flags = ApprovedExtension, |
| 901 const char* const* prefixes = nullptr) { | 894 const char* const* prefixes = nullptr) { |
| 902 m_extensions.append(TraceWrapperMember<ExtensionTracker>( | 895 m_extensions.append(TraceWrapperMember<ExtensionTracker>( |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 context, | 1668 context, |
| 1676 context->is3d(), | 1669 context->is3d(), |
| 1677 context.is3d()); | 1670 context.is3d()); |
| 1678 | 1671 |
| 1679 } // namespace blink | 1672 } // namespace blink |
| 1680 | 1673 |
| 1681 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( | 1674 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( |
| 1682 blink::WebGLRenderingContextBase::TextureUnitState); | 1675 blink::WebGLRenderingContextBase::TextureUnitState); |
| 1683 | 1676 |
| 1684 #endif // WebGLRenderingContextBase_h | 1677 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |