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

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

Issue 2401893002: [wrapper-tracing] WebGL and friends: Add write barriers (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef WebGLRenderingContextBase_h 26 #ifndef WebGLRenderingContextBase_h
27 #define WebGLRenderingContextBase_h 27 #define WebGLRenderingContextBase_h
28 28
29 #include "bindings/core/v8/Nullable.h" 29 #include "bindings/core/v8/Nullable.h"
30 #include "bindings/core/v8/ScriptState.h" 30 #include "bindings/core/v8/ScriptState.h"
31 #include "bindings/core/v8/ScriptValue.h" 31 #include "bindings/core/v8/ScriptValue.h"
32 #include "bindings/core/v8/ScriptWrappable.h" 32 #include "bindings/core/v8/ScriptWrappable.h"
33 #include "bindings/core/v8/ScriptWrappableVisitor.h"
33 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
34 #include "core/dom/DOMTypedArray.h" 35 #include "core/dom/DOMTypedArray.h"
35 #include "core/dom/TypedFlexibleArrayBufferView.h" 36 #include "core/dom/TypedFlexibleArrayBufferView.h"
36 #include "core/html/canvas/CanvasContextCreationAttributes.h" 37 #include "core/html/canvas/CanvasContextCreationAttributes.h"
37 #include "core/html/canvas/CanvasRenderingContext.h" 38 #include "core/html/canvas/CanvasRenderingContext.h"
38 #include "core/layout/ContentChangeType.h" 39 #include "core/layout/ContentChangeType.h"
39 #include "modules/webgl/WebGLContextAttributes.h" 40 #include "modules/webgl/WebGLContextAttributes.h"
40 #include "modules/webgl/WebGLExtensionName.h" 41 #include "modules/webgl/WebGLExtensionName.h"
41 #include "modules/webgl/WebGLTexture.h" 42 #include "modules/webgl/WebGLTexture.h"
42 #include "modules/webgl/WebGLVertexArrayObjectBase.h" 43 #include "modules/webgl/WebGLVertexArrayObjectBase.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 580
580 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 581 DECLARE_VIRTUAL_TRACE_WRAPPERS();
581 582
582 // Returns approximate gpu memory allocated per pixel. 583 // Returns approximate gpu memory allocated per pixel.
583 int externallyAllocatedBytesPerPixel() override; 584 int externallyAllocatedBytesPerPixel() override;
584 585
585 class TextureUnitState { 586 class TextureUnitState {
586 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 587 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
587 588
588 public: 589 public:
589 Member<WebGLTexture> m_texture2DBinding; 590 TraceWrapperMember<WebGLTexture> m_texture2DBinding;
590 Member<WebGLTexture> m_textureCubeMapBinding; 591 TraceWrapperMember<WebGLTexture> m_textureCubeMapBinding;
591 Member<WebGLTexture> m_texture3DBinding; 592 TraceWrapperMember<WebGLTexture> m_texture3DBinding;
592 Member<WebGLTexture> m_texture2DArrayBinding; 593 TraceWrapperMember<WebGLTexture> m_texture2DArrayBinding;
593 594
594 DECLARE_TRACE(); 595 DECLARE_TRACE();
596 DECLARE_TRACE_WRAPPERS();
595 }; 597 };
596 598
597 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const override; 599 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const override;
598 void setFilterQuality(SkFilterQuality) override; 600 void setFilterQuality(SkFilterQuality) override;
599 bool isWebGL2OrHigher() { return version() >= 2; } 601 bool isWebGL2OrHigher() { return version() >= 2; }
600 602
601 void getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffscreenCanvas&) const; 603 void getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffscreenCanvas&) const;
602 604
603 void commit(ExceptionState&); 605 void commit(ExceptionState&);
604 606
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 // was lost. For better portability we always defer the dispatch of the event. 706 // was lost. For better portability we always defer the dispatch of the event.
705 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; 707 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer;
706 bool m_restoreAllowed; 708 bool m_restoreAllowed;
707 Timer<WebGLRenderingContextBase> m_restoreTimer; 709 Timer<WebGLRenderingContextBase> m_restoreTimer;
708 710
709 bool m_markedCanvasDirty; 711 bool m_markedCanvasDirty;
710 HeapHashSet<WeakMember<WebGLContextObject>> m_contextObjects; 712 HeapHashSet<WeakMember<WebGLContextObject>> m_contextObjects;
711 713
712 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and 714 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and
713 // stored values for ELEMENT_ARRAY_BUFFER 715 // stored values for ELEMENT_ARRAY_BUFFER
714 Member<WebGLBuffer> m_boundArrayBuffer; 716 TraceWrapperMember<WebGLBuffer> m_boundArrayBuffer;
715 717
716 Member<WebGLVertexArrayObjectBase> m_defaultVertexArrayObject; 718 Member<WebGLVertexArrayObjectBase> m_defaultVertexArrayObject;
717 Member<WebGLVertexArrayObjectBase> m_boundVertexArrayObject; 719 TraceWrapperMember<WebGLVertexArrayObjectBase> m_boundVertexArrayObject;
718 void setBoundVertexArrayObject(WebGLVertexArrayObjectBase*); 720 void setBoundVertexArrayObject(WebGLVertexArrayObjectBase*);
719 721
720 enum VertexAttribValueType { 722 enum VertexAttribValueType {
721 Float32ArrayType, 723 Float32ArrayType,
722 Int32ArrayType, 724 Int32ArrayType,
723 Uint32ArrayType, 725 Uint32ArrayType,
724 }; 726 };
725 727
726 Vector<VertexAttribValueType> m_vertexAttribType; 728 Vector<VertexAttribValueType> m_vertexAttribType;
727 unsigned m_maxVertexAttribs; 729 unsigned m_maxVertexAttribs;
728 void setVertexAttribType(GLuint index, VertexAttribValueType); 730 void setVertexAttribType(GLuint index, VertexAttribValueType);
729 731
730 Member<WebGLProgram> m_currentProgram; 732 TraceWrapperMember<WebGLProgram> m_currentProgram;
731 Member<WebGLFramebuffer> m_framebufferBinding; 733 TraceWrapperMember<WebGLFramebuffer> m_framebufferBinding;
732 Member<WebGLRenderbuffer> m_renderbufferBinding; 734 TraceWrapperMember<WebGLRenderbuffer> m_renderbufferBinding;
733 735
734 HeapVector<TextureUnitState> m_textureUnits; 736 HeapVector<TextureUnitState> m_textureUnits;
735 unsigned long m_activeTextureUnit; 737 unsigned long m_activeTextureUnit;
736 738
737 Vector<GLenum> m_compressedTextureFormats; 739 Vector<GLenum> m_compressedTextureFormats;
738 740
739 // Fixed-size cache of reusable image buffers for video texImage2D calls. 741 // Fixed-size cache of reusable image buffers for video texImage2D calls.
740 class LRUImageBufferCache { 742 class LRUImageBufferCache {
741 public: 743 public:
742 LRUImageBufferCache(int capacity); 744 LRUImageBufferCache(int capacity);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 : ExtensionTracker(flags, prefixes), m_extensionField(extensionField) {} 879 : ExtensionTracker(flags, prefixes), m_extensionField(extensionField) {}
878 880
879 GC_PLUGIN_IGNORE("http://crbug.com/519953") 881 GC_PLUGIN_IGNORE("http://crbug.com/519953")
880 Member<T>& m_extensionField; 882 Member<T>& m_extensionField;
881 // ExtensionTracker holds it's own reference to the extension to ensure 883 // ExtensionTracker holds it's own reference to the extension to ensure
882 // 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
883 Member<T> m_extension; 885 Member<T> m_extension;
884 }; 886 };
885 887
886 bool m_extensionEnabled[WebGLExtensionNameCount]; 888 bool m_extensionEnabled[WebGLExtensionNameCount];
887 HeapVector<Member<ExtensionTracker>> m_extensions; 889 HeapVector<TraceWrapperMember<ExtensionTracker>> m_extensions;
888 890
889 template <typename T> 891 template <typename T>
890 void registerExtension(Member<T>& extensionPtr, 892 void registerExtension(Member<T>& extensionPtr,
891 ExtensionFlags flags = ApprovedExtension, 893 ExtensionFlags flags = ApprovedExtension,
892 const char* const* prefixes = nullptr) { 894 const char* const* prefixes = nullptr) {
893 m_extensions.append( 895 m_extensions.append(TraceWrapperMember<ExtensionTracker>(
894 TypedExtensionTracker<T>::create(extensionPtr, flags, prefixes)); 896 this, TypedExtensionTracker<T>::create(extensionPtr, flags, prefixes)));
895 } 897 }
896 898
897 bool extensionSupportedAndAllowed(const ExtensionTracker*); 899 bool extensionSupportedAndAllowed(const ExtensionTracker*);
898 900
899 inline bool extensionEnabled(WebGLExtensionName name) { 901 inline bool extensionEnabled(WebGLExtensionName name) {
900 return m_extensionEnabled[name]; 902 return m_extensionEnabled[name];
901 } 903 }
902 904
903 // ScopedDrawingBufferBinder is used for 905 // ScopedDrawingBufferBinder is used for
904 // ReadPixels/CopyTexImage2D/CopySubImage2D to read from a multisampled 906 // ReadPixels/CopyTexImage2D/CopySubImage2D to read from a multisampled
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 context, 1552 context,
1551 context->is3d(), 1553 context->is3d(),
1552 context.is3d()); 1554 context.is3d());
1553 1555
1554 } // namespace blink 1556 } // namespace blink
1555 1557
1556 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( 1558 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(
1557 blink::WebGLRenderingContextBase::TextureUnitState); 1559 blink::WebGLRenderingContextBase::TextureUnitState);
1558 1560
1559 #endif // WebGLRenderingContextBase_h 1561 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698