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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 void clearStencil(GLint); | 139 void clearStencil(GLint); |
140 void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alp ha); | 140 void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alp ha); |
141 void compileShader(WebGLShader*); | 141 void compileShader(WebGLShader*); |
142 | 142 |
143 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView* data); | 143 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView* data); |
144 void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin t yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* data); | 144 void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin t yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* data); |
145 | 145 |
146 void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); | 146 void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); |
147 void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff set, GLint x, GLint y, GLsizei width, GLsizei height); | 147 void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff set, GLint x, GLint y, GLsizei width, GLsizei height); |
148 | 148 |
149 PassRefPtr<WebGLBuffer> createBuffer(); | 149 PassRefPtrWillBeRawPtr<WebGLBuffer> createBuffer(); |
150 PassRefPtr<WebGLFramebuffer> createFramebuffer(); | 150 PassRefPtrWillBeRawPtr<WebGLFramebuffer> createFramebuffer(); |
151 PassRefPtr<WebGLProgram> createProgram(); | 151 PassRefPtrWillBeRawPtr<WebGLProgram> createProgram(); |
152 PassRefPtr<WebGLRenderbuffer> createRenderbuffer(); | 152 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> createRenderbuffer(); |
153 PassRefPtr<WebGLShader> createShader(GLenum type); | 153 PassRefPtrWillBeRawPtr<WebGLShader> createShader(GLenum type); |
154 PassRefPtr<WebGLTexture> createTexture(); | 154 PassRefPtrWillBeRawPtr<WebGLTexture> createTexture(); |
155 | 155 |
156 void cullFace(GLenum mode); | 156 void cullFace(GLenum mode); |
157 | 157 |
158 void deleteBuffer(WebGLBuffer*); | 158 void deleteBuffer(WebGLBuffer*); |
159 void deleteFramebuffer(WebGLFramebuffer*); | 159 void deleteFramebuffer(WebGLFramebuffer*); |
160 void deleteProgram(WebGLProgram*); | 160 void deleteProgram(WebGLProgram*); |
161 void deleteRenderbuffer(WebGLRenderbuffer*); | 161 void deleteRenderbuffer(WebGLRenderbuffer*); |
162 void deleteShader(WebGLShader*); | 162 void deleteShader(WebGLShader*); |
163 void deleteTexture(WebGLTexture*); | 163 void deleteTexture(WebGLTexture*); |
164 | 164 |
(...skipping 11 matching lines...) Expand all Loading... | |
176 | 176 |
177 void enable(GLenum cap); | 177 void enable(GLenum cap); |
178 void enableVertexAttribArray(GLuint index); | 178 void enableVertexAttribArray(GLuint index); |
179 void finish(); | 179 void finish(); |
180 void flush(); | 180 void flush(); |
181 void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render buffertarget, WebGLRenderbuffer*); | 181 void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render buffertarget, WebGLRenderbuffer*); |
182 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget , WebGLTexture*, GLint level); | 182 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget , WebGLTexture*, GLint level); |
183 void frontFace(GLenum mode); | 183 void frontFace(GLenum mode); |
184 void generateMipmap(GLenum target); | 184 void generateMipmap(GLenum target); |
185 | 185 |
186 PassRefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GLuint index); | 186 PassRefPtrWillBeRawPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GLuin t index); |
187 PassRefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GLuint index); | 187 PassRefPtrWillBeRawPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GLui nt index); |
188 bool getAttachedShaders(WebGLProgram*, Vector<RefPtr<WebGLShader> >&); | 188 bool getAttachedShaders(WebGLProgram*, WillBeHeapVector<RefPtrWillBeMember<W ebGLShader> >&); |
189 GLint getAttribLocation(WebGLProgram*, const String& name); | 189 GLint getAttribLocation(WebGLProgram*, const String& name); |
190 WebGLGetInfo getBufferParameter(GLenum target, GLenum pname); | 190 WebGLGetInfo getBufferParameter(GLenum target, GLenum pname); |
191 PassRefPtr<WebGLContextAttributes> getContextAttributes(); | 191 PassRefPtrWillBeRawPtr<WebGLContextAttributes> getContextAttributes(); |
192 GLenum getError(); | 192 GLenum getError(); |
193 PassRefPtr<WebGLExtension> getExtension(const String& name); | 193 PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(const String& name); |
194 WebGLGetInfo getFramebufferAttachmentParameter(GLenum target, GLenum attachm ent, GLenum pname); | 194 WebGLGetInfo getFramebufferAttachmentParameter(GLenum target, GLenum attachm ent, GLenum pname); |
195 WebGLGetInfo getParameter(GLenum pname); | 195 WebGLGetInfo getParameter(GLenum pname); |
196 WebGLGetInfo getProgramParameter(WebGLProgram*, GLenum pname); | 196 WebGLGetInfo getProgramParameter(WebGLProgram*, GLenum pname); |
197 String getProgramInfoLog(WebGLProgram*); | 197 String getProgramInfoLog(WebGLProgram*); |
198 WebGLGetInfo getRenderbufferParameter(GLenum target, GLenum pname); | 198 WebGLGetInfo getRenderbufferParameter(GLenum target, GLenum pname); |
199 WebGLGetInfo getShaderParameter(WebGLShader*, GLenum pname); | 199 WebGLGetInfo getShaderParameter(WebGLShader*, GLenum pname); |
200 String getShaderInfoLog(WebGLShader*); | 200 String getShaderInfoLog(WebGLShader*); |
201 PassRefPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat(GLenum shade rType, GLenum precisionType); | 201 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat( GLenum shaderType, GLenum precisionType); |
202 String getShaderSource(WebGLShader*); | 202 String getShaderSource(WebGLShader*); |
203 Vector<String> getSupportedExtensions(); | 203 Vector<String> getSupportedExtensions(); |
204 WebGLGetInfo getTexParameter(GLenum target, GLenum pname); | 204 WebGLGetInfo getTexParameter(GLenum target, GLenum pname); |
205 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*); | 205 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*); |
206 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str ing&); | 206 PassRefPtrWillBeRawPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram *, const String&); |
207 WebGLGetInfo getVertexAttrib(GLuint index, GLenum pname); | 207 WebGLGetInfo getVertexAttrib(GLuint index, GLenum pname); |
208 long long getVertexAttribOffset(GLuint index, GLenum pname); | 208 long long getVertexAttribOffset(GLuint index, GLenum pname); |
209 | 209 |
210 void hint(GLenum target, GLenum mode); | 210 void hint(GLenum target, GLenum mode); |
211 GLboolean isBuffer(WebGLBuffer*); | 211 GLboolean isBuffer(WebGLBuffer*); |
212 bool isContextLost() const; | 212 bool isContextLost() const; |
213 GLboolean isEnabled(GLenum cap); | 213 GLboolean isEnabled(GLenum cap); |
214 GLboolean isFramebuffer(WebGLFramebuffer*); | 214 GLboolean isFramebuffer(WebGLFramebuffer*); |
215 GLboolean isProgram(WebGLProgram*); | 215 GLboolean isProgram(WebGLProgram*); |
216 GLboolean isRenderbuffer(WebGLRenderbuffer*); | 216 GLboolean isRenderbuffer(WebGLRenderbuffer*); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 void removeSharedObject(WebGLSharedObject*); | 342 void removeSharedObject(WebGLSharedObject*); |
343 void removeContextObject(WebGLContextObject*); | 343 void removeContextObject(WebGLContextObject*); |
344 | 344 |
345 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } | 345 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } |
346 | 346 |
347 // ActiveDOMObject notifications | 347 // ActiveDOMObject notifications |
348 virtual bool hasPendingActivity() const OVERRIDE; | 348 virtual bool hasPendingActivity() const OVERRIDE; |
349 virtual void stop() OVERRIDE; | 349 virtual void stop() OVERRIDE; |
350 | 350 |
351 void setSavingImage(bool isSaving) { m_savingImage = isSaving; } | 351 void setSavingImage(bool isSaving) { m_savingImage = isSaving; } |
352 | |
353 virtual void trace(Visitor*) OVERRIDE; | |
354 | |
355 class TextureUnitState { | |
356 ALLOW_ONLY_INLINE_ALLOCATION(); | |
357 public: | |
358 RefPtrWillBeMember<WebGLTexture> m_texture2DBinding; | |
359 RefPtrWillBeMember<WebGLTexture> m_textureCubeMapBinding; | |
360 | |
361 void trace(Visitor*); | |
362 }; | |
363 | |
352 protected: | 364 protected: |
353 friend class WebGLDrawBuffers; | 365 friend class WebGLDrawBuffers; |
354 friend class WebGLFramebuffer; | 366 friend class WebGLFramebuffer; |
355 friend class WebGLObject; | 367 friend class WebGLObject; |
356 friend class OESVertexArrayObject; | 368 friend class OESVertexArrayObject; |
357 friend class WebGLDebugShaders; | 369 friend class WebGLDebugShaders; |
358 friend class WebGLCompressedTextureATC; | 370 friend class WebGLCompressedTextureATC; |
359 friend class WebGLCompressedTextureETC1; | 371 friend class WebGLCompressedTextureETC1; |
360 friend class WebGLCompressedTexturePVRTC; | 372 friend class WebGLCompressedTexturePVRTC; |
361 friend class WebGLCompressedTextureS3TC; | 373 friend class WebGLCompressedTextureS3TC; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 // This is used both for synthetic and real context losses. For real ones, i t's | 420 // This is used both for synthetic and real context losses. For real ones, i t's |
409 // likely that there's no JavaScript on the stack, but that might be depende nt | 421 // likely that there's no JavaScript on the stack, but that might be depende nt |
410 // on how exactly the platform discovers that the context was lost. For bett er | 422 // on how exactly the platform discovers that the context was lost. For bett er |
411 // portability we always defer the dispatch of the event. | 423 // portability we always defer the dispatch of the event. |
412 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; | 424 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; |
413 bool m_restoreAllowed; | 425 bool m_restoreAllowed; |
414 Timer<WebGLRenderingContextBase> m_restoreTimer; | 426 Timer<WebGLRenderingContextBase> m_restoreTimer; |
415 | 427 |
416 bool m_needsUpdate; | 428 bool m_needsUpdate; |
417 bool m_markedCanvasDirty; | 429 bool m_markedCanvasDirty; |
418 HashSet<WebGLContextObject*> m_contextObjects; | 430 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject> > m_contextObje cts; |
419 | 431 |
420 OwnPtr<WebGLRenderingContextLostCallback> m_contextLostCallbackAdapter; | 432 OwnPtrWillBeMember<WebGLRenderingContextLostCallback> m_contextLostCallbackA dapter; |
421 OwnPtr<WebGLRenderingContextErrorMessageCallback> m_errorMessageCallbackAdap ter; | 433 OwnPtrWillBeMember<WebGLRenderingContextErrorMessageCallback> m_errorMessage CallbackAdapter; |
422 | 434 |
423 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a nd stored values for ELEMENT_ARRAY_BUFFER | 435 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a nd stored values for ELEMENT_ARRAY_BUFFER |
424 RefPtr<WebGLBuffer> m_boundArrayBuffer; | 436 RefPtrWillBeMember<WebGLBuffer> m_boundArrayBuffer; |
425 | 437 |
426 RefPtr<WebGLVertexArrayObjectOES> m_defaultVertexArrayObject; | 438 RefPtrWillBeMember<WebGLVertexArrayObjectOES> m_defaultVertexArrayObject; |
427 RefPtr<WebGLVertexArrayObjectOES> m_boundVertexArrayObject; | 439 RefPtrWillBeMember<WebGLVertexArrayObjectOES> m_boundVertexArrayObject; |
428 void setBoundVertexArrayObject(PassRefPtr<WebGLVertexArrayObjectOES> arrayOb ject) | 440 void setBoundVertexArrayObject(PassRefPtrWillBeRawPtr<WebGLVertexArrayObject OES> arrayObject) |
429 { | 441 { |
430 if (arrayObject) | 442 if (arrayObject) |
431 m_boundVertexArrayObject = arrayObject; | 443 m_boundVertexArrayObject = arrayObject; |
432 else | 444 else |
433 m_boundVertexArrayObject = m_defaultVertexArrayObject; | 445 m_boundVertexArrayObject = m_defaultVertexArrayObject; |
434 } | 446 } |
435 | 447 |
436 class VertexAttribValue { | 448 class VertexAttribValue { |
437 public: | 449 public: |
438 VertexAttribValue() | 450 VertexAttribValue() |
439 { | 451 { |
440 initValue(); | 452 initValue(); |
441 } | 453 } |
442 | 454 |
443 void initValue() | 455 void initValue() |
444 { | 456 { |
445 value[0] = 0.0f; | 457 value[0] = 0.0f; |
446 value[1] = 0.0f; | 458 value[1] = 0.0f; |
447 value[2] = 0.0f; | 459 value[2] = 0.0f; |
448 value[3] = 1.0f; | 460 value[3] = 1.0f; |
449 } | 461 } |
450 | 462 |
451 GLfloat value[4]; | 463 GLfloat value[4]; |
452 }; | 464 }; |
453 Vector<VertexAttribValue> m_vertexAttribValue; | 465 Vector<VertexAttribValue> m_vertexAttribValue; |
454 unsigned m_maxVertexAttribs; | 466 unsigned m_maxVertexAttribs; |
455 RefPtr<WebGLBuffer> m_vertexAttrib0Buffer; | 467 RefPtrWillBeMember<WebGLBuffer> m_vertexAttrib0Buffer; |
456 long m_vertexAttrib0BufferSize; | 468 long m_vertexAttrib0BufferSize; |
457 GLfloat m_vertexAttrib0BufferValue[4]; | 469 GLfloat m_vertexAttrib0BufferValue[4]; |
458 bool m_forceAttrib0BufferRefill; | 470 bool m_forceAttrib0BufferRefill; |
459 bool m_vertexAttrib0UsedBefore; | 471 bool m_vertexAttrib0UsedBefore; |
460 | 472 |
461 RefPtr<WebGLProgram> m_currentProgram; | 473 RefPtrWillBeMember<WebGLProgram> m_currentProgram; |
462 RefPtr<WebGLFramebuffer> m_framebufferBinding; | 474 RefPtrWillBeMember<WebGLFramebuffer> m_framebufferBinding; |
463 RefPtr<WebGLRenderbuffer> m_renderbufferBinding; | 475 RefPtrWillBeMember<WebGLRenderbuffer> m_renderbufferBinding; |
464 class TextureUnitState { | 476 |
465 public: | 477 WillBeHeapVector<TextureUnitState> m_textureUnits; |
466 RefPtr<WebGLTexture> m_texture2DBinding; | |
467 RefPtr<WebGLTexture> m_textureCubeMapBinding; | |
468 }; | |
469 Vector<TextureUnitState> m_textureUnits; | |
470 unsigned long m_activeTextureUnit; | 478 unsigned long m_activeTextureUnit; |
471 | 479 |
472 RefPtr<WebGLTexture> m_blackTexture2D; | 480 RefPtrWillBeMember<WebGLTexture> m_blackTexture2D; |
473 RefPtr<WebGLTexture> m_blackTextureCubeMap; | 481 RefPtrWillBeMember<WebGLTexture> m_blackTextureCubeMap; |
474 | 482 |
475 Vector<GLenum> m_compressedTextureFormats; | 483 Vector<GLenum> m_compressedTextureFormats; |
476 | 484 |
477 // Fixed-size cache of reusable image buffers for video texImage2D calls. | 485 // Fixed-size cache of reusable image buffers for video texImage2D calls. |
478 class LRUImageBufferCache { | 486 class LRUImageBufferCache { |
479 public: | 487 public: |
480 LRUImageBufferCache(int capacity); | 488 LRUImageBufferCache(int capacity); |
481 // The pointer returned is owned by the image buffer map. | 489 // The pointer returned is owned by the image buffer map. |
482 ImageBuffer* imageBuffer(const IntSize& size); | 490 ImageBuffer* imageBuffer(const IntSize& size); |
483 private: | 491 private: |
(...skipping 16 matching lines...) Expand all Loading... | |
500 bool m_drawBuffersWebGLRequirementsChecked; | 508 bool m_drawBuffersWebGLRequirementsChecked; |
501 bool m_drawBuffersSupported; | 509 bool m_drawBuffersSupported; |
502 | 510 |
503 GLint m_packAlignment; | 511 GLint m_packAlignment; |
504 GLint m_unpackAlignment; | 512 GLint m_unpackAlignment; |
505 bool m_unpackFlipY; | 513 bool m_unpackFlipY; |
506 bool m_unpackPremultiplyAlpha; | 514 bool m_unpackPremultiplyAlpha; |
507 GLenum m_unpackColorspaceConversion; | 515 GLenum m_unpackColorspaceConversion; |
508 bool m_contextLost; | 516 bool m_contextLost; |
509 LostContextMode m_contextLostMode; | 517 LostContextMode m_contextLostMode; |
510 RefPtr<WebGLContextAttributes> m_requestedAttributes; | 518 RefPtrWillBeMember<WebGLContextAttributes> m_requestedAttributes; |
511 | 519 |
512 bool m_layerCleared; | 520 bool m_layerCleared; |
513 GLfloat m_clearColor[4]; | 521 GLfloat m_clearColor[4]; |
514 bool m_scissorEnabled; | 522 bool m_scissorEnabled; |
515 GLfloat m_clearDepth; | 523 GLfloat m_clearDepth; |
516 GLint m_clearStencil; | 524 GLint m_clearStencil; |
517 GLboolean m_colorMask[4]; | 525 GLboolean m_colorMask[4]; |
518 GLboolean m_depthMask; | 526 GLboolean m_depthMask; |
519 | 527 |
520 bool m_stencilEnabled; | 528 bool m_stencilEnabled; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 } | 565 } |
558 | 566 |
559 bool draft() const | 567 bool draft() const |
560 { | 568 { |
561 return m_draft; | 569 return m_draft; |
562 } | 570 } |
563 | 571 |
564 const char* const* prefixes() const; | 572 const char* const* prefixes() const; |
565 bool matchesNameWithPrefixes(const String&) const; | 573 bool matchesNameWithPrefixes(const String&) const; |
566 | 574 |
567 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas e*) = 0; | 575 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi ngContextBase*) = 0; |
568 virtual bool supported(WebGLRenderingContextBase*) const = 0; | 576 virtual bool supported(WebGLRenderingContextBase*) const = 0; |
569 virtual const char* extensionName() const = 0; | 577 virtual const char* extensionName() const = 0; |
570 virtual void loseExtension() = 0; | 578 virtual void loseExtension() = 0; |
571 | 579 |
580 virtual void trace(Visitor*) { } | |
581 | |
572 private: | 582 private: |
573 bool m_draft; | 583 bool m_draft; |
574 const char* const* m_prefixes; | 584 const char* const* m_prefixes; |
575 }; | 585 }; |
576 | 586 |
577 template <typename T> | 587 template <typename T> |
578 class TypedExtensionTracker FINAL : public ExtensionTracker { | 588 class TypedExtensionTracker FINAL : public ExtensionTracker { |
579 public: | 589 public: |
580 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c onst char* const* prefixes) | 590 static PassOwnPtr<TypedExtensionTracker<T> > create(RefPtrWillBeMember<T >& extensionField, ExtensionFlags flags, const char* const* prefixes) |
581 : ExtensionTracker(flags, prefixes) | |
582 , m_extensionField(extensionField) | |
583 , m_extension(nullptr) | |
584 { | 591 { |
592 return adoptPtr(new TypedExtensionTracker<T>(extensionField, flags, prefixes)); | |
585 } | 593 } |
586 | 594 |
587 virtual ~TypedExtensionTracker() | 595 virtual ~TypedExtensionTracker() |
588 { | 596 { |
589 if (m_extension) { | 597 if (m_extension) { |
590 m_extension->lose(true); | 598 m_extension->lose(true); |
591 m_extension = nullptr; | 599 m_extension = nullptr; |
592 } | 600 } |
593 } | 601 } |
594 | 602 |
595 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas e* context) OVERRIDE | 603 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi ngContextBase* context) OVERRIDE |
596 { | 604 { |
597 if (!m_extension) { | 605 if (!m_extension) { |
598 m_extension = T::create(context); | 606 m_extension = T::create(context); |
599 m_extensionField = m_extension; | 607 m_extensionField = m_extension; |
600 } | 608 } |
601 | 609 |
602 return m_extension; | 610 return m_extension; |
603 } | 611 } |
604 | 612 |
605 virtual bool supported(WebGLRenderingContextBase* context) const OVERRID E | 613 virtual bool supported(WebGLRenderingContextBase* context) const OVERRID E |
606 { | 614 { |
607 return T::supported(context); | 615 return T::supported(context); |
608 } | 616 } |
609 | 617 |
610 virtual const char* extensionName() const OVERRIDE | 618 virtual const char* extensionName() const OVERRIDE |
611 { | 619 { |
612 return T::extensionName(); | 620 return T::extensionName(); |
613 } | 621 } |
614 | 622 |
615 virtual void loseExtension() OVERRIDE | 623 virtual void loseExtension() OVERRIDE |
616 { | 624 { |
617 if (m_extension) { | 625 if (m_extension) { |
618 m_extension->lose(false); | 626 m_extension->lose(false); |
619 if (m_extension->isLost()) | 627 if (m_extension->isLost()) |
620 m_extension = nullptr; | 628 m_extension = nullptr; |
621 } | 629 } |
622 } | 630 } |
623 | 631 |
632 virtual void trace(Visitor* visitor) OVERRIDE | |
633 { | |
634 visitor->trace(m_extension); | |
635 ExtensionTracker::trace(visitor); | |
636 } | |
637 | |
624 private: | 638 private: |
625 RefPtr<T>& m_extensionField; | 639 TypedExtensionTracker(RefPtrWillBeMember<T>& extensionField, ExtensionFl ags flags, const char* const* prefixes) |
640 : ExtensionTracker(flags, prefixes) | |
641 , m_extensionField(extensionField) | |
642 , m_extension(nullptr) | |
643 { | |
644 } | |
645 | |
646 // FIXME: Oilpan: off-heap (vector) collections with OwnPtr<>s | |
647 // to objects with trace() methods are currently supported, | |
648 // but not specially recognized by the clang plugin. | |
649 GC_PLUGIN_IGNORE("340522") | |
650 RefPtrWillBeMember<T>& m_extensionField; | |
haraken
2014/07/03 04:40:29
Not directly related to this CL, we might want to
| |
626 // ExtensionTracker holds it's own reference to the extension to ensure | 651 // ExtensionTracker holds it's own reference to the extension to ensure |
627 // that it is not deleted before this object's destructor is called | 652 // that it is not deleted before this object's destructor is called |
628 RefPtr<T> m_extension; | 653 GC_PLUGIN_IGNORE("340522") |
654 RefPtrWillBeMember<T> m_extension; | |
haraken
2014/07/03 04:40:29
Shouldn't this be RefPtrWillBePersistent, since Ex
sof
2014/07/03 07:25:49
It is off-heap, but traced. See above FIXME.
| |
629 }; | 655 }; |
630 | 656 |
631 bool m_extensionEnabled[WebGLExtensionNameCount]; | 657 bool m_extensionEnabled[WebGLExtensionNameCount]; |
632 Vector<ExtensionTracker*> m_extensions; | 658 Vector<OwnPtr<ExtensionTracker> > m_extensions; |
633 | 659 |
634 template <typename T> | 660 template <typename T> |
635 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro vedExtension, const char* const* prefixes = 0) | 661 void registerExtension(RefPtrWillBeMember<T>& extensionPtr, ExtensionFlags f lags = ApprovedExtension, const char* const* prefixes = 0) |
636 { | 662 { |
637 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr efixes)); | 663 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes)); |
638 } | 664 } |
639 | 665 |
640 bool extensionSupportedAndAllowed(const ExtensionTracker*); | 666 bool extensionSupportedAndAllowed(const ExtensionTracker*); |
641 | 667 |
642 inline bool extensionEnabled(WebGLExtensionName name) | 668 inline bool extensionEnabled(WebGLExtensionName name) |
643 { | 669 { |
644 return m_extensionEnabled[name]; | 670 return m_extensionEnabled[name]; |
645 } | 671 } |
646 | 672 |
647 // Errors raised by synthesizeGLError() while the context is lost. | 673 // Errors raised by synthesizeGLError() while the context is lost. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 // Return the least recently used context's position in the active context v ector. | 927 // Return the least recently used context's position in the active context v ector. |
902 // If the vector is empty, return the maximum allowed active context number. | 928 // If the vector is empty, return the maximum allowed active context number. |
903 static size_t oldestContextIndex(); | 929 static size_t oldestContextIndex(); |
904 static IntSize oldestContextSize(); | 930 static IntSize oldestContextSize(); |
905 }; | 931 }; |
906 | 932 |
907 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); | 933 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); |
908 | 934 |
909 } // namespace WebCore | 935 } // namespace WebCore |
910 | 936 |
937 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(WebCore::WebGLRenderingContex tBase::TextureUnitState); | |
938 | |
911 #endif // WebGLRenderingContextBase_h | 939 #endif // WebGLRenderingContextBase_h |
OLD | NEW |