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

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

Powered by Google App Engine
This is Rietveld 408576698