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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 Loading... | |
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(); |
haraken
2015/08/04 00:06:52
Sigbjorn: It looks like the destructor of WebGLRen
sof
2015/08/04 05:11:56
They're all WebGLObjects (and WebGLSharedObjects),
| |
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 Loading... | |
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 Loading... | |
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") |
haraken
2015/08/04 00:06:52
I think we should remove the GC_PLUGIN_IGNORE by r
peria
2015/08/04 09:10:26
Acknowledged.
http://crbug.com/516604
| |
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; |
haraken
2015/08/04 00:06:52
Ditto. Let's move CanvasRenderingContext to the oi
peria
2015/08/04 09:10:26
Acknowledged.
| |
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 Loading... | |
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 class ExtensionTracker : public GarbageCollected<ExtensionTracker> { |
619 public: | 619 public: |
620 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) | 620 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) |
621 : m_draft(flags & DraftExtension) | 621 : m_draft(flags & DraftExtension) |
622 , m_prefixes(prefixes) | 622 , m_prefixes(prefixes) |
623 { | 623 { |
624 } | 624 } |
625 | 625 |
626 #if !ENABLE(OILPAN) | |
627 virtual ~ExtensionTracker() | |
628 { | |
629 } | |
630 #endif | |
631 | |
632 bool draft() const | 626 bool draft() const |
633 { | 627 { |
634 return m_draft; | 628 return m_draft; |
635 } | 629 } |
636 | 630 |
637 const char* const* prefixes() const; | 631 const char* const* prefixes() const; |
638 bool matchesNameWithPrefixes(const String&) const; | 632 bool matchesNameWithPrefixes(const String&) const; |
639 | 633 |
640 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi ngContextBase*) = 0; | 634 virtual WebGLExtension* getExtension(WebGLRenderingContextBase*) = 0; |
641 virtual bool supported(WebGLRenderingContextBase*) const = 0; | 635 virtual bool supported(WebGLRenderingContextBase*) const = 0; |
642 virtual const char* extensionName() const = 0; | 636 virtual const char* extensionName() const = 0; |
643 virtual void loseExtension() = 0; | 637 virtual void loseExtension() = 0; |
644 | 638 |
645 DEFINE_INLINE_VIRTUAL_TRACE() { } | 639 DEFINE_INLINE_VIRTUAL_TRACE() { } |
646 | 640 |
647 private: | 641 private: |
648 bool m_draft; | 642 bool m_draft; |
649 const char* const* m_prefixes; | 643 const char* const* m_prefixes; |
650 }; | 644 }; |
651 | 645 |
652 template <typename T> | 646 template <typename T> |
653 class TypedExtensionTracker final : public ExtensionTracker { | 647 class TypedExtensionTracker final : public ExtensionTracker { |
654 public: | 648 public: |
655 static PassOwnPtrWillBeRawPtr<TypedExtensionTracker<T>> create(RefPtrWil lBeMember<T>& extensionField, ExtensionFlags flags, const char* const* prefixes) | 649 static TypedExtensionTracker<T>* create(PersistentWillBeMember<T>& exten sionField, ExtensionFlags flags, const char* const* prefixes) |
656 { | 650 { |
657 return adoptPtrWillBeNoop(new TypedExtensionTracker<T>(extensionFiel d, flags, prefixes)); | 651 return new TypedExtensionTracker<T>(extensionField, flags, prefixes) ; |
658 } | 652 } |
659 | 653 |
660 #if !ENABLE(OILPAN) | 654 WebGLExtension* getExtension(WebGLRenderingContextBase* context) overrid e |
661 ~TypedExtensionTracker() override | |
662 { | |
663 if (m_extension) { | |
664 m_extension->lose(true); | |
665 m_extension = nullptr; | |
666 } | |
667 } | |
668 #endif | |
669 | |
670 PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderingContex tBase* context) override | |
671 { | 655 { |
672 if (!m_extension) { | 656 if (!m_extension) { |
673 m_extension = T::create(context); | 657 m_extension = T::create(context); |
674 m_extensionField = m_extension; | 658 m_extensionField = m_extension; |
675 } | 659 } |
676 | 660 |
677 return m_extension; | 661 return m_extension; |
678 } | 662 } |
679 | 663 |
680 bool supported(WebGLRenderingContextBase* context) const override | 664 bool supported(WebGLRenderingContextBase* context) const override |
(...skipping 15 matching lines...) Expand all Loading... | |
696 } | 680 } |
697 } | 681 } |
698 | 682 |
699 DEFINE_INLINE_VIRTUAL_TRACE() | 683 DEFINE_INLINE_VIRTUAL_TRACE() |
700 { | 684 { |
701 visitor->trace(m_extension); | 685 visitor->trace(m_extension); |
702 ExtensionTracker::trace(visitor); | 686 ExtensionTracker::trace(visitor); |
703 } | 687 } |
704 | 688 |
705 private: | 689 private: |
706 TypedExtensionTracker(RefPtrWillBeMember<T>& extensionField, ExtensionFl ags flags, const char* const* prefixes) | 690 TypedExtensionTracker(PersistentWillBeMember<T>& extensionField, Extensi onFlags flags, const char* const* prefixes) |
707 : ExtensionTracker(flags, prefixes) | 691 : ExtensionTracker(flags, prefixes) |
708 , m_extensionField(extensionField) | 692 , m_extensionField(extensionField) |
709 { | 693 { |
710 } | 694 } |
711 | 695 |
712 RefPtrWillBeMember<T>& m_extensionField; | 696 PersistentWillBeMember<T>& m_extensionField; |
haraken
2015/08/04 00:06:52
It looks really nasty to keep a reference to a Per
Ken Russell (switch to Gerrit)
2015/08/04 00:34:11
I'm pretty sure that this is intended to keep the
haraken
2015/08/04 00:47:05
Maybe a better idea would be:
- make TypedExtensi
Ken Russell (switch to Gerrit)
2015/08/04 00:54:19
I'm not sure I understand the second suggestion.
| |
713 // ExtensionTracker holds it's own reference to the extension to ensure | 697 // ExtensionTracker holds it's own reference to the extension to ensure |
714 // that it is not deleted before this object's destructor is called | 698 // that it is not deleted before this object's destructor is called |
715 RefPtrWillBeMember<T> m_extension; | 699 Member<T> m_extension; |
716 }; | 700 }; |
717 | 701 |
718 bool m_extensionEnabled[WebGLExtensionNameCount]; | 702 bool m_extensionEnabled[WebGLExtensionNameCount]; |
719 WillBeHeapVector<OwnPtrWillBeMember<ExtensionTracker>> m_extensions; | 703 PersistentHeapVectorWillBeHeapVector<Member<ExtensionTracker>> m_extensions; |
720 | 704 |
721 template <typename T> | 705 template <typename T> |
722 void registerExtension(RefPtrWillBeMember<T>& extensionPtr, ExtensionFlags f lags = ApprovedExtension, const char* const* prefixes = 0) | 706 void registerExtension(PersistentWillBeMember<T>& extensionPtr, ExtensionFla gs flags = ApprovedExtension, const char* const* prefixes = nullptr) |
723 { | 707 { |
724 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes)); | 708 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes)); |
725 } | 709 } |
726 | 710 |
727 bool extensionSupportedAndAllowed(const ExtensionTracker*); | 711 bool extensionSupportedAndAllowed(const ExtensionTracker*); |
728 | 712 |
729 inline bool extensionEnabled(WebGLExtensionName name) | 713 inline bool extensionEnabled(WebGLExtensionName name) |
730 { | 714 { |
731 return m_extensionEnabled[name]; | 715 return m_extensionEnabled[name]; |
732 } | 716 } |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 static IntSize oldestContextSize(); | 1034 static IntSize oldestContextSize(); |
1051 }; | 1035 }; |
1052 | 1036 |
1053 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); | 1037 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); |
1054 | 1038 |
1055 } // namespace blink | 1039 } // namespace blink |
1056 | 1040 |
1057 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); | 1041 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); |
1058 | 1042 |
1059 #endif // WebGLRenderingContextBase_h | 1043 #endif // WebGLRenderingContextBase_h |
OLD | NEW |