Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Issue 2539113002: [wrapper-tracing] Fix WebGL extension and attachment handling (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 {
810 public: 811 public:
811 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) 812 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes)
812 : m_draft(flags & DraftExtension), m_prefixes(prefixes) {} 813 : m_draft(flags & DraftExtension), m_prefixes(prefixes) {}
813 814
814 bool draft() const { return m_draft; } 815 bool draft() const { return m_draft; }
815 816
816 const char* const* prefixes() const; 817 const char* const* prefixes() const;
817 bool matchesNameWithPrefixes(const String&) const; 818 bool matchesNameWithPrefixes(const String&) const;
818 819
819 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0; 820 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 866
866 WebGLExtension* getExtensionObjectIfAlreadyEnabled() override { 867 WebGLExtension* getExtensionObjectIfAlreadyEnabled() override {
867 return m_extension; 868 return m_extension;
868 } 869 }
869 870
870 DEFINE_INLINE_VIRTUAL_TRACE() { 871 DEFINE_INLINE_VIRTUAL_TRACE() {
871 visitor->trace(m_extension); 872 visitor->trace(m_extension);
872 ExtensionTracker::trace(visitor); 873 ExtensionTracker::trace(visitor);
873 } 874 }
874 875
876 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() {
877 visitor->traceWrappers(m_extension);
878 }
879
875 private: 880 private:
876 TypedExtensionTracker(Member<T>& extensionField, 881 TypedExtensionTracker(Member<T>& extensionField,
877 ExtensionFlags flags, 882 ExtensionFlags flags,
878 const char* const* prefixes) 883 const char* const* prefixes)
879 : ExtensionTracker(flags, prefixes), m_extensionField(extensionField) {} 884 : ExtensionTracker(flags, prefixes),
885 m_extensionField(extensionField),
886 m_extension(this, nullptr) {}
880 887
881 GC_PLUGIN_IGNORE("http://crbug.com/519953") 888 GC_PLUGIN_IGNORE("http://crbug.com/519953")
882 Member<T>& m_extensionField; 889 Member<T>& m_extensionField;
883 // ExtensionTracker holds it's own reference to the extension to ensure 890 // ExtensionTracker holds it's own reference to the extension to ensure
884 // that it is not deleted before this object's destructor is called 891 // that it is not deleted before this object's destructor is called
885 Member<T> m_extension; 892 TraceWrapperMember<T> m_extension;
886 }; 893 };
887 894
888 bool m_extensionEnabled[WebGLExtensionNameCount]; 895 bool m_extensionEnabled[WebGLExtensionNameCount];
889 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions; 896 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions;
890 897
891 template <typename T> 898 template <typename T>
892 void registerExtension(Member<T>& extensionPtr, 899 void registerExtension(Member<T>& extensionPtr,
893 ExtensionFlags flags = ApprovedExtension, 900 ExtensionFlags flags = ApprovedExtension,
894 const char* const* prefixes = nullptr) { 901 const char* const* prefixes = nullptr) {
895 m_extensions.append(TraceWrapperMember<ExtensionTracker>( 902 m_extensions.append(TraceWrapperMember<ExtensionTracker>(
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 context, 1675 context,
1669 context->is3d(), 1676 context->is3d(),
1670 context.is3d()); 1677 context.is3d());
1671 1678
1672 } // namespace blink 1679 } // namespace blink
1673 1680
1674 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( 1681 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(
1675 blink::WebGLRenderingContextBase::TextureUnitState); 1682 blink::WebGLRenderingContextBase::TextureUnitState);
1676 1683
1677 #endif // WebGLRenderingContextBase_h 1684 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698