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

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

Issue 1234883002: [Oilpan] Migrate classes under module/webgl onto oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 months 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void clearStencil(GLint); 165 void clearStencil(GLint);
166 void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alp ha); 166 void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alp ha);
167 void compileShader(WebGLShader*); 167 void compileShader(WebGLShader*);
168 168
169 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, DOMArrayBufferView* data); 169 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, DOMArrayBufferView* data);
170 void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin t yoffset, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* dat a); 170 void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin t yoffset, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* dat a);
171 171
172 void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); 172 void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
173 void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff set, GLint x, GLint y, GLsizei width, GLsizei height); 173 void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff set, GLint x, GLint y, GLsizei width, GLsizei height);
174 174
175 PassRefPtrWillBeRawPtr<WebGLBuffer> createBuffer(); 175 WebGLBuffer* createBuffer();
176 PassRefPtrWillBeRawPtr<WebGLFramebuffer> createFramebuffer(); 176 WebGLFramebuffer* createFramebuffer();
177 PassRefPtrWillBeRawPtr<WebGLProgram> createProgram(); 177 WebGLProgram* createProgram();
178 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> createRenderbuffer(); 178 WebGLRenderbuffer* createRenderbuffer();
179 PassRefPtrWillBeRawPtr<WebGLShader> createShader(GLenum type); 179 WebGLShader* createShader(GLenum type);
180 PassRefPtrWillBeRawPtr<WebGLTexture> createTexture(); 180 WebGLTexture* createTexture();
181 181
182 void cullFace(GLenum mode); 182 void cullFace(GLenum mode);
183 183
184 void deleteBuffer(WebGLBuffer*); 184 void deleteBuffer(WebGLBuffer*);
185 virtual void deleteFramebuffer(WebGLFramebuffer*); 185 virtual void deleteFramebuffer(WebGLFramebuffer*);
186 void deleteProgram(WebGLProgram*); 186 void deleteProgram(WebGLProgram*);
187 void deleteRenderbuffer(WebGLRenderbuffer*); 187 void deleteRenderbuffer(WebGLRenderbuffer*);
188 void deleteShader(WebGLShader*); 188 void deleteShader(WebGLShader*);
189 void deleteTexture(WebGLTexture*); 189 void deleteTexture(WebGLTexture*);
190 190
(...skipping 11 matching lines...) Expand all
202 202
203 void enable(GLenum cap); 203 void enable(GLenum cap);
204 void enableVertexAttribArray(GLuint index); 204 void enableVertexAttribArray(GLuint index);
205 void finish(); 205 void finish();
206 void flush(); 206 void flush();
207 void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render buffertarget, WebGLRenderbuffer*); 207 void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render buffertarget, WebGLRenderbuffer*);
208 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget , WebGLTexture*, GLint level); 208 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget , WebGLTexture*, GLint level);
209 void frontFace(GLenum mode); 209 void frontFace(GLenum mode);
210 void generateMipmap(GLenum target); 210 void generateMipmap(GLenum target);
211 211
212 PassRefPtrWillBeRawPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GLuin t index); 212 WebGLActiveInfo* getActiveAttrib(WebGLProgram*, GLuint index);
213 PassRefPtrWillBeRawPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GLui nt index); 213 WebGLActiveInfo* getActiveUniform(WebGLProgram*, GLuint index);
214 bool getAttachedShaders(WebGLProgram*, WillBeHeapVector<RefPtrWillBeMember<W ebGLShader>>&); 214 bool getAttachedShaders(WebGLProgram*, HeapVector<Member<WebGLShader>>&);
215 Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> getAttachedShade rs(WebGLProgram*); 215 Nullable<HeapVector<Member<WebGLShader>>> getAttachedShaders(WebGLProgram*);
216 GLint getAttribLocation(WebGLProgram*, const String& name); 216 GLint getAttribLocation(WebGLProgram*, const String& name);
217 ScriptValue getBufferParameter(ScriptState*, GLenum target, GLenum pname); 217 ScriptValue getBufferParameter(ScriptState*, GLenum target, GLenum pname);
218 void getContextAttributes(Nullable<WebGLContextAttributes>&); 218 void getContextAttributes(Nullable<WebGLContextAttributes>&);
219 GLenum getError(); 219 GLenum getError();
220 ScriptValue getExtension(ScriptState*, const String& name); 220 ScriptValue getExtension(ScriptState*, const String& name);
221 virtual ScriptValue getFramebufferAttachmentParameter(ScriptState*, GLenum t arget, GLenum attachment, GLenum pname); 221 virtual ScriptValue getFramebufferAttachmentParameter(ScriptState*, GLenum t arget, GLenum attachment, GLenum pname);
222 virtual ScriptValue getParameter(ScriptState*, GLenum pname); 222 virtual ScriptValue getParameter(ScriptState*, GLenum pname);
223 ScriptValue getProgramParameter(ScriptState*, WebGLProgram*, GLenum pname); 223 ScriptValue getProgramParameter(ScriptState*, WebGLProgram*, GLenum pname);
224 String getProgramInfoLog(WebGLProgram*); 224 String getProgramInfoLog(WebGLProgram*);
225 ScriptValue getRenderbufferParameter(ScriptState*, GLenum target, GLenum pna me); 225 ScriptValue getRenderbufferParameter(ScriptState*, GLenum target, GLenum pna me);
226 ScriptValue getShaderParameter(ScriptState*, WebGLShader*, GLenum pname); 226 ScriptValue getShaderParameter(ScriptState*, WebGLShader*, GLenum pname);
227 String getShaderInfoLog(WebGLShader*); 227 String getShaderInfoLog(WebGLShader*);
228 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat( GLenum shaderType, GLenum precisionType); 228 WebGLShaderPrecisionFormat* getShaderPrecisionFormat(GLenum shaderType, GLen um precisionType);
229 String getShaderSource(WebGLShader*); 229 String getShaderSource(WebGLShader*);
230 Nullable<Vector<String>> getSupportedExtensions(); 230 Nullable<Vector<String>> getSupportedExtensions();
231 virtual ScriptValue getTexParameter(ScriptState*, GLenum target, GLenum pnam e); 231 virtual ScriptValue getTexParameter(ScriptState*, GLenum target, GLenum pnam e);
232 ScriptValue getUniform(ScriptState*, WebGLProgram*, const WebGLUniformLocati on*); 232 ScriptValue getUniform(ScriptState*, WebGLProgram*, const WebGLUniformLocati on*);
233 PassRefPtrWillBeRawPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram *, const String&); 233 WebGLUniformLocation* getUniformLocation(WebGLProgram*, const String&);
234 ScriptValue getVertexAttrib(ScriptState*, GLuint index, GLenum pname); 234 ScriptValue getVertexAttrib(ScriptState*, GLuint index, GLenum pname);
235 long long getVertexAttribOffset(GLuint index, GLenum pname); 235 long long getVertexAttribOffset(GLuint index, GLenum pname);
236 236
237 void hint(GLenum target, GLenum mode); 237 void hint(GLenum target, GLenum mode);
238 GLboolean isBuffer(WebGLBuffer*); 238 GLboolean isBuffer(WebGLBuffer*);
239 bool isContextLost() const override; 239 bool isContextLost() const override;
240 GLboolean isEnabled(GLenum cap); 240 GLboolean isEnabled(GLenum cap);
241 GLboolean isFramebuffer(WebGLFramebuffer*); 241 GLboolean isFramebuffer(WebGLFramebuffer*);
242 GLboolean isProgram(WebGLProgram*); 242 GLboolean isProgram(WebGLProgram*);
243 GLboolean isRenderbuffer(WebGLRenderbuffer*); 243 GLboolean isRenderbuffer(WebGLRenderbuffer*);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 void markLayerComposited() override; 365 void markLayerComposited() override;
366 ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) override; 366 ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) override;
367 367
368 void removeSharedObject(WebGLSharedObject*); 368 void removeSharedObject(WebGLSharedObject*);
369 void removeContextObject(WebGLContextObject*); 369 void removeContextObject(WebGLContextObject*);
370 370
371 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } 371 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; }
372 372
373 // GL_CHROMIUM_subscribe_uniform 373 // GL_CHROMIUM_subscribe_uniform
374 PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> createValuebufferCHROMIUM(); 374 CHROMIUMValuebuffer* createValuebufferCHROMIUM();
375 void deleteValuebufferCHROMIUM(CHROMIUMValuebuffer*); 375 void deleteValuebufferCHROMIUM(CHROMIUMValuebuffer*);
376 GLboolean isValuebufferCHROMIUM(CHROMIUMValuebuffer*); 376 GLboolean isValuebufferCHROMIUM(CHROMIUMValuebuffer*);
377 void bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer*); 377 void bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer*);
378 void subscribeValueCHROMIUM(GLenum target, GLenum subscription); 378 void subscribeValueCHROMIUM(GLenum target, GLenum subscription);
379 void populateSubscribedValuesCHROMIUM(GLenum target); 379 void populateSubscribedValuesCHROMIUM(GLenum target);
380 void uniformValuebufferCHROMIUM(const WebGLUniformLocation*, GLenum target, GLenum subscription); 380 void uniformValuebufferCHROMIUM(const WebGLUniformLocation*, GLenum target, GLenum subscription);
381 381
382 // Eagerly finalize WebGLRenderingContextBase in order for it 382 // Eagerly finalize WebGLRenderingContextBase in order for it
383 // to (first) be able to detach its WebGLContextObjects, before 383 // to (first) be able to detach its WebGLContextObjects, before
384 // they're later swept and finalized. 384 // they're later swept and finalized.
385 EAGERLY_FINALIZE(); 385 EAGERLY_FINALIZE();
386 DECLARE_VIRTUAL_TRACE(); 386 DECLARE_VIRTUAL_TRACE();
387 387
388 // Returns approximate gpu memory allocated per pixel. 388 // Returns approximate gpu memory allocated per pixel.
389 int externallyAllocatedBytesPerPixel() override; 389 int externallyAllocatedBytesPerPixel() override;
390 390
391 class TextureUnitState { 391 class TextureUnitState {
392 ALLOW_ONLY_INLINE_ALLOCATION(); 392 ALLOW_ONLY_INLINE_ALLOCATION();
393 public: 393 public:
394 RefPtrWillBeMember<WebGLTexture> m_texture2DBinding; 394 Member<WebGLTexture> m_texture2DBinding;
395 RefPtrWillBeMember<WebGLTexture> m_textureCubeMapBinding; 395 Member<WebGLTexture> m_textureCubeMapBinding;
396 RefPtrWillBeMember<WebGLTexture> m_texture3DBinding; 396 Member<WebGLTexture> m_texture3DBinding;
397 RefPtrWillBeMember<WebGLTexture> m_texture2DArrayBinding; 397 Member<WebGLTexture> m_texture2DArrayBinding;
398 398
399 DECLARE_TRACE(); 399 DECLARE_TRACE();
400 }; 400 };
401 401
402 void setFilterQuality(SkFilterQuality) override; 402 void setFilterQuality(SkFilterQuality) override;
403 bool isWebGL2OrHigher() { return version() >= 2; } 403 bool isWebGL2OrHigher() { return version() >= 2; }
404 404
405 protected: 405 protected:
406 friend class WebGLDrawBuffers; 406 friend class WebGLDrawBuffers;
407 friend class WebGLFramebuffer; 407 friend class WebGLFramebuffer;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // Dispatches a context lost event once it is determined that one is needed. 473 // Dispatches a context lost event once it is determined that one is needed.
474 // This is used for synthetic, WEBGL_lose_context and real context losses. F or real ones, it's 474 // This is used for synthetic, WEBGL_lose_context and real context losses. F or real ones, it's
475 // likely that there's no JavaScript on the stack, but that might be depende nt 475 // likely that there's no JavaScript on the stack, but that might be depende nt
476 // on how exactly the platform discovers that the context was lost. For bett er 476 // on how exactly the platform discovers that the context was lost. For bett er
477 // portability we always defer the dispatch of the event. 477 // portability we always defer the dispatch of the event.
478 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; 478 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer;
479 bool m_restoreAllowed; 479 bool m_restoreAllowed;
480 Timer<WebGLRenderingContextBase> m_restoreTimer; 480 Timer<WebGLRenderingContextBase> m_restoreTimer;
481 481
482 bool m_markedCanvasDirty; 482 bool m_markedCanvasDirty;
483 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject>> m_contextObjec ts; 483 PersistentHeapHashSetWillBeHeapHashSet<WeakMember<WebGLContextObject>> m_con textObjects;
Ken Russell (switch to Gerrit) 2015/08/01 00:11:56 Should we file a bug about removing this weak map?
peria 2015/08/03 09:00:36 I agree that the reference cycle will not make orp
484 484
485 OwnPtrWillBeMember<WebGLRenderingContextLostCallback> m_contextLostCallbackA dapter; 485 PersistentWillBeMember<WebGLRenderingContextLostCallback> m_contextLostCallb ackAdapter;
486 OwnPtrWillBeMember<WebGLRenderingContextErrorMessageCallback> m_errorMessage CallbackAdapter; 486 PersistentWillBeMember<WebGLRenderingContextErrorMessageCallback> m_errorMes sageCallbackAdapter;
487 487
488 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a nd stored values for ELEMENT_ARRAY_BUFFER 488 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a nd stored values for ELEMENT_ARRAY_BUFFER
489 RefPtrWillBeMember<WebGLBuffer> m_boundArrayBuffer; 489 PersistentWillBeMember<WebGLBuffer> m_boundArrayBuffer;
490 490
491 RefPtrWillBeMember<WebGLVertexArrayObjectBase> m_defaultVertexArrayObject; 491 PersistentWillBeMember<WebGLVertexArrayObjectBase> m_defaultVertexArrayObjec t;
492 RefPtrWillBeMember<WebGLVertexArrayObjectBase> m_boundVertexArrayObject; 492 PersistentWillBeMember<WebGLVertexArrayObjectBase> m_boundVertexArrayObject;
493 void setBoundVertexArrayObject(PassRefPtrWillBeRawPtr<WebGLVertexArrayObject Base> arrayObject) 493 void setBoundVertexArrayObject(WebGLVertexArrayObjectBase* arrayObject)
494 { 494 {
495 if (arrayObject) 495 if (arrayObject)
496 m_boundVertexArrayObject = arrayObject; 496 m_boundVertexArrayObject = arrayObject;
497 else 497 else
498 m_boundVertexArrayObject = m_defaultVertexArrayObject; 498 m_boundVertexArrayObject = m_defaultVertexArrayObject;
499 } 499 }
500 500
501 enum VertexAttribValueType { 501 enum VertexAttribValueType {
502 Float32ArrayType, 502 Float32ArrayType,
503 Int32ArrayType, 503 Int32ArrayType,
(...skipping 18 matching lines...) Expand all
522 522
523 VertexAttribValueType type; 523 VertexAttribValueType type;
524 union { 524 union {
525 GLfloat floatValue[4]; 525 GLfloat floatValue[4];
526 GLint intValue[4]; 526 GLint intValue[4];
527 GLuint uintValue[4]; 527 GLuint uintValue[4];
528 } value; 528 } value;
529 }; 529 };
530 Vector<VertexAttribValue> m_vertexAttribValue; 530 Vector<VertexAttribValue> m_vertexAttribValue;
531 unsigned m_maxVertexAttribs; 531 unsigned m_maxVertexAttribs;
532 RefPtrWillBeMember<WebGLBuffer> m_vertexAttrib0Buffer; 532 PersistentWillBeMember<WebGLBuffer> m_vertexAttrib0Buffer;
533 long m_vertexAttrib0BufferSize; 533 long m_vertexAttrib0BufferSize;
534 GLfloat m_vertexAttrib0BufferValue[4]; 534 GLfloat m_vertexAttrib0BufferValue[4];
535 bool m_forceAttrib0BufferRefill; 535 bool m_forceAttrib0BufferRefill;
536 bool m_vertexAttrib0UsedBefore; 536 bool m_vertexAttrib0UsedBefore;
537 537
538 RefPtrWillBeMember<WebGLProgram> m_currentProgram; 538 PersistentWillBeMember<WebGLProgram> m_currentProgram;
539 RefPtrWillBeMember<WebGLFramebuffer> m_framebufferBinding; 539 PersistentWillBeMember<WebGLFramebuffer> m_framebufferBinding;
540 RefPtrWillBeMember<WebGLRenderbuffer> m_renderbufferBinding; 540 PersistentWillBeMember<WebGLRenderbuffer> m_renderbufferBinding;
541 RefPtrWillBeMember<CHROMIUMValuebuffer> m_valuebufferBinding; 541 PersistentWillBeMember<CHROMIUMValuebuffer> m_valuebufferBinding;
542 542
543 GC_PLUGIN_IGNORE("crbug.com/496496") 543 GC_PLUGIN_IGNORE("crbug.com/496496")
544 WillBeHeapVector<TextureUnitState> m_textureUnits; 544 PersistentHeapVectorWillBeHeapVector<TextureUnitState> m_textureUnits;
545 unsigned long m_activeTextureUnit; 545 unsigned long m_activeTextureUnit;
546 546
547 RefPtrWillBeMember<WebGLTexture> m_blackTexture2D; 547 PersistentWillBeMember<WebGLTexture> m_blackTexture2D;
548 RefPtrWillBeMember<WebGLTexture> m_blackTextureCubeMap; 548 PersistentWillBeMember<WebGLTexture> m_blackTextureCubeMap;
549 549
550 Vector<GLenum> m_compressedTextureFormats; 550 Vector<GLenum> m_compressedTextureFormats;
551 551
552 // Fixed-size cache of reusable image buffers for video texImage2D calls. 552 // Fixed-size cache of reusable image buffers for video texImage2D calls.
553 class LRUImageBufferCache { 553 class LRUImageBufferCache {
554 public: 554 public:
555 LRUImageBufferCache(int capacity); 555 LRUImageBufferCache(int capacity);
556 // The pointer returned is owned by the image buffer map. 556 // The pointer returned is owned by the image buffer map.
557 ImageBuffer* imageBuffer(const IntSize& size); 557 ImageBuffer* imageBuffer(const IntSize& size);
558 private: 558 private:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 unsigned long m_onePlusMaxNonDefaultTextureUnit; 607 unsigned long m_onePlusMaxNonDefaultTextureUnit;
608 608
609 OwnPtr<Extensions3DUtil> m_extensionsUtil; 609 OwnPtr<Extensions3DUtil> m_extensionsUtil;
610 610
611 enum ExtensionFlags { 611 enum ExtensionFlags {
612 ApprovedExtension = 0x00, 612 ApprovedExtension = 0x00,
613 // Extension that is behind the draft extensions runtime flag: 613 // Extension that is behind the draft extensions runtime flag:
614 DraftExtension = 0x01, 614 DraftExtension = 0x01,
615 }; 615 };
616 616
617 class ExtensionTracker : public NoBaseWillBeGarbageCollected<ExtensionTracke r> { 617 class ExtensionTracker : public GarbageCollected<ExtensionTracker> {
618 public: 618 public:
619 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) 619 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes)
620 : m_draft(flags & DraftExtension) 620 : m_draft(flags & DraftExtension)
621 , m_prefixes(prefixes) 621 , m_prefixes(prefixes)
622 { 622 {
623 } 623 }
624 624
625 #if !ENABLE(OILPAN)
626 virtual ~ExtensionTracker()
627 {
628 }
629 #endif
630
631 bool draft() const 625 bool draft() const
632 { 626 {
633 return m_draft; 627 return m_draft;
634 } 628 }
635 629
636 const char* const* prefixes() const; 630 const char* const* prefixes() const;
637 bool matchesNameWithPrefixes(const String&) const; 631 bool matchesNameWithPrefixes(const String&) const;
638 632
639 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi ngContextBase*) = 0; 633 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0;
640 virtual bool supported(WebGLRenderingContextBase*) const = 0; 634 virtual bool supported(WebGLRenderingContextBase*) const = 0;
641 virtual const char* extensionName() const = 0; 635 virtual const char* extensionName() const = 0;
642 virtual void loseExtension() = 0; 636 virtual void loseExtension() = 0;
643 637
644 DEFINE_INLINE_VIRTUAL_TRACE() { } 638 DEFINE_INLINE_VIRTUAL_TRACE() { }
645 639
646 private: 640 private:
647 bool m_draft; 641 bool m_draft;
648 const char* const* m_prefixes; 642 const char* const* m_prefixes;
649 }; 643 };
650 644
651 template <typename T> 645 template <typename T>
652 class TypedExtensionTracker final : public ExtensionTracker { 646 class TypedExtensionTracker final : public ExtensionTracker {
653 public: 647 public:
654 static PassOwnPtrWillBeRawPtr<TypedExtensionTracker<T>> create(RefPtrWil lBeMember<T>& extensionField, ExtensionFlags flags, const char* const* prefixes) 648 static TypedExtensionTracker<T>* create(PersistentWillBeMember<T>& exten sionField, ExtensionFlags flags, const char* const* prefixes)
655 { 649 {
656 return adoptPtrWillBeNoop(new TypedExtensionTracker<T>(extensionFiel d, flags, prefixes)); 650 return new TypedExtensionTracker<T>(extensionField, flags, prefixes) ;
657 } 651 }
658 652
659 #if !ENABLE(OILPAN) 653 WebGLExtension* getExtension(WebGLRenderingContextBase* context) overrid e
660 ~TypedExtensionTracker() override
661 {
662 if (m_extension) {
663 m_extension->lose(true);
664 m_extension = nullptr;
665 }
666 }
667 #endif
668
669 PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderingContex tBase* context) override
670 { 654 {
671 if (!m_extension) { 655 if (!m_extension) {
672 m_extension = T::create(context); 656 m_extension = T::create(context);
673 m_extensionField = m_extension; 657 m_extensionField = m_extension;
674 } 658 }
675 659
676 return m_extension; 660 return m_extension;
677 } 661 }
678 662
679 bool supported(WebGLRenderingContextBase* context) const override 663 bool supported(WebGLRenderingContextBase* context) const override
(...skipping 15 matching lines...) Expand all
695 } 679 }
696 } 680 }
697 681
698 DEFINE_INLINE_VIRTUAL_TRACE() 682 DEFINE_INLINE_VIRTUAL_TRACE()
699 { 683 {
700 visitor->trace(m_extension); 684 visitor->trace(m_extension);
701 ExtensionTracker::trace(visitor); 685 ExtensionTracker::trace(visitor);
702 } 686 }
703 687
704 private: 688 private:
705 TypedExtensionTracker(RefPtrWillBeMember<T>& extensionField, ExtensionFl ags flags, const char* const* prefixes) 689 TypedExtensionTracker(PersistentWillBeMember<T>& extensionField, Extensi onFlags flags, const char* const* prefixes)
706 : ExtensionTracker(flags, prefixes) 690 : ExtensionTracker(flags, prefixes)
707 , m_extensionField(extensionField) 691 , m_extensionField(extensionField)
708 { 692 {
709 } 693 }
710 694
711 RefPtrWillBeMember<T>& m_extensionField; 695 PersistentWillBeMember<T>& m_extensionField;
712 // ExtensionTracker holds it's own reference to the extension to ensure 696 // ExtensionTracker holds it's own reference to the extension to ensure
713 // that it is not deleted before this object's destructor is called 697 // that it is not deleted before this object's destructor is called
714 RefPtrWillBeMember<T> m_extension; 698 Member<T> m_extension;
715 }; 699 };
716 700
717 bool m_extensionEnabled[WebGLExtensionNameCount]; 701 bool m_extensionEnabled[WebGLExtensionNameCount];
718 WillBeHeapVector<OwnPtrWillBeMember<ExtensionTracker>> m_extensions; 702 PersistentHeapVectorWillBeHeapVector<Member<ExtensionTracker>> m_extensions;
719 703
720 template <typename T> 704 template <typename T>
721 void registerExtension(RefPtrWillBeMember<T>& extensionPtr, ExtensionFlags f lags = ApprovedExtension, const char* const* prefixes = 0) 705 void registerExtension(PersistentWillBeMember<T>& extensionPtr, ExtensionFla gs flags = ApprovedExtension, const char* const* prefixes = nullptr)
722 { 706 {
723 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes)); 707 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes));
724 } 708 }
725 709
726 bool extensionSupportedAndAllowed(const ExtensionTracker*); 710 bool extensionSupportedAndAllowed(const ExtensionTracker*);
727 711
728 inline bool extensionEnabled(WebGLExtensionName name) 712 inline bool extensionEnabled(WebGLExtensionName name)
729 { 713 {
730 return m_extensionEnabled[name]; 714 return m_extensionEnabled[name];
731 } 715 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 static IntSize oldestContextSize(); 1030 static IntSize oldestContextSize();
1047 }; 1031 };
1048 1032
1049 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1033 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1050 1034
1051 } // namespace blink 1035 } // namespace blink
1052 1036
1053 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1037 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1054 1038
1055 #endif // WebGLRenderingContextBase_h 1039 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698