| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 public: | 497 public: |
| 498 static PassOwnPtr<WebGLRenderingContextLostCallback> create(WebGLRenderingCo
ntextBase* context) | 498 static PassOwnPtr<WebGLRenderingContextLostCallback> create(WebGLRenderingCo
ntextBase* context) |
| 499 { | 499 { |
| 500 return adoptPtr(new WebGLRenderingContextLostCallback(context)); | 500 return adoptPtr(new WebGLRenderingContextLostCallback(context)); |
| 501 } | 501 } |
| 502 | 502 |
| 503 virtual ~WebGLRenderingContextLostCallback() { } | 503 virtual ~WebGLRenderingContextLostCallback() { } |
| 504 | 504 |
| 505 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon
textBase::RealLostContext, WebGLRenderingContextBase::Auto); } | 505 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon
textBase::RealLostContext, WebGLRenderingContextBase::Auto); } |
| 506 | 506 |
| 507 void trace(Visitor* visitor) | |
| 508 { | |
| 509 visitor->trace(m_context); | |
| 510 } | |
| 511 | |
| 512 private: | 507 private: |
| 513 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex
t) | 508 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex
t) |
| 514 : m_context(context) { } | 509 : m_context(context) { } |
| 515 | 510 |
| 516 RawPtr<WebGLRenderingContextBase> m_context; | 511 RawPtr<WebGLRenderingContextBase> m_context; |
| 517 }; | 512 }; |
| 518 | 513 |
| 519 class WebGLRenderingContextErrorMessageCallback final : public blink::WebGraphic
sContext3D::WebGraphicsErrorMessageCallback { | 514 class WebGLRenderingContextErrorMessageCallback final : public blink::WebGraphic
sContext3D::WebGraphicsErrorMessageCallback { |
| 520 WTF_MAKE_FAST_ALLOCATED; | 515 WTF_MAKE_FAST_ALLOCATED; |
| 521 public: | 516 public: |
| 522 static PassOwnPtr<WebGLRenderingContextErrorMessageCallback> create(WebGLRen
deringContextBase* context) | 517 static PassOwnPtr<WebGLRenderingContextErrorMessageCallback> create(WebGLRen
deringContextBase* context) |
| 523 { | 518 { |
| 524 return adoptPtr(new WebGLRenderingContextErrorMessageCallback(context)); | 519 return adoptPtr(new WebGLRenderingContextErrorMessageCallback(context)); |
| 525 } | 520 } |
| 526 | 521 |
| 527 virtual ~WebGLRenderingContextErrorMessageCallback() { } | 522 virtual ~WebGLRenderingContextErrorMessageCallback() { } |
| 528 | 523 |
| 529 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint
) | 524 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint
) |
| 530 { | 525 { |
| 531 if (m_context->m_synthesizedErrorsToConsole) | 526 if (m_context->m_synthesizedErrorsToConsole) |
| 532 m_context->printGLErrorToConsole(message); | 527 m_context->printGLErrorToConsole(message); |
| 533 } | 528 } |
| 534 | 529 |
| 535 void trace(Visitor* visitor) | |
| 536 { | |
| 537 visitor->trace(m_context); | |
| 538 } | |
| 539 | |
| 540 private: | 530 private: |
| 541 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase
* context) | 531 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase
* context) |
| 542 : m_context(context) { } | 532 : m_context(context) { } |
| 543 | 533 |
| 544 RawPtr<WebGLRenderingContextBase> m_context; | 534 RawPtr<WebGLRenderingContextBase> m_context; |
| 545 }; | 535 }; |
| 546 | 536 |
| 547 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r
equestedAttributes) | 537 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r
equestedAttributes) |
| 548 : CanvasRenderingContext(passedCanvas) | 538 : CanvasRenderingContext(passedCanvas) |
| 549 , ActiveDOMObject(&passedCanvas->document()) | 539 , ActiveDOMObject(&passedCanvas->document()) |
| (...skipping 5055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5605 for (int i = startIndex; i >= 0; --i) { | 5595 for (int i = startIndex; i >= 0; --i) { |
| 5606 if (m_textureUnits[i].m_texture2DBinding | 5596 if (m_textureUnits[i].m_texture2DBinding |
| 5607 || m_textureUnits[i].m_textureCubeMapBinding) { | 5597 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5608 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5598 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5609 return; | 5599 return; |
| 5610 } | 5600 } |
| 5611 } | 5601 } |
| 5612 m_onePlusMaxNonDefaultTextureUnit = 0; | 5602 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5613 } | 5603 } |
| 5614 | 5604 |
| 5615 void WebGLRenderingContextBase::TextureUnitState::trace(Visitor* visitor) | |
| 5616 { | |
| 5617 visitor->trace(m_texture2DBinding); | |
| 5618 visitor->trace(m_textureCubeMapBinding); | |
| 5619 } | |
| 5620 | |
| 5621 void WebGLRenderingContextBase::trace(Visitor* visitor) | |
| 5622 { | |
| 5623 #if ENABLE(OILPAN) | |
| 5624 visitor->trace(m_contextObjects); | |
| 5625 #endif | |
| 5626 visitor->trace(m_contextLostCallbackAdapter); | |
| 5627 visitor->trace(m_errorMessageCallbackAdapter); | |
| 5628 visitor->trace(m_boundArrayBuffer); | |
| 5629 visitor->trace(m_defaultVertexArrayObject); | |
| 5630 visitor->trace(m_boundVertexArrayObject); | |
| 5631 visitor->trace(m_vertexAttrib0Buffer); | |
| 5632 visitor->trace(m_currentProgram); | |
| 5633 visitor->trace(m_framebufferBinding); | |
| 5634 visitor->trace(m_renderbufferBinding); | |
| 5635 visitor->trace(m_textureUnits); | |
| 5636 visitor->trace(m_blackTexture2D); | |
| 5637 visitor->trace(m_blackTextureCubeMap); | |
| 5638 visitor->trace(m_requestedAttributes); | |
| 5639 visitor->trace(m_extensions); | |
| 5640 CanvasRenderingContext::trace(visitor); | |
| 5641 } | |
| 5642 | |
| 5643 #if ENABLE(OILPAN) | 5605 #if ENABLE(OILPAN) |
| 5644 PassRefPtr<WebGLSharedWebGraphicsContext3D> WebGLRenderingContextBase::sharedWeb
GraphicsContext3D() const | 5606 PassRefPtr<WebGLSharedWebGraphicsContext3D> WebGLRenderingContextBase::sharedWeb
GraphicsContext3D() const |
| 5645 { | 5607 { |
| 5646 return m_sharedWebGraphicsContext3D; | 5608 return m_sharedWebGraphicsContext3D; |
| 5647 } | 5609 } |
| 5648 | 5610 |
| 5649 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 5611 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 5650 { | 5612 { |
| 5651 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; | 5613 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; |
| 5652 } | 5614 } |
| 5653 #else | 5615 #else |
| 5654 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 5616 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 5655 { | 5617 { |
| 5656 return m_drawingBuffer.get(); | 5618 return m_drawingBuffer.get(); |
| 5657 } | 5619 } |
| 5658 #endif | 5620 #endif |
| 5659 | 5621 |
| 5660 } // namespace blink | 5622 } // namespace blink |
| OLD | NEW |