| Index: Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| index bcf1a10ae65da690d43f1828cf206946252c421a..d9c6fc734c7c977139edc4ca5927661d65590571 100644
|
| --- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| +++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| @@ -148,6 +148,7 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<blink::WebGraphicsContext3D> context,
|
| , m_sampleCount(0)
|
| , m_packAlignment(4)
|
| , m_destructionInProgress(false)
|
| + , m_isHidden(false)
|
| , m_contextEvictionManager(contextEvictionManager)
|
| {
|
| // Used by browser tests to detect the use of a DrawingBuffer.
|
| @@ -185,6 +186,28 @@ void DrawingBuffer::markLayerComposited()
|
| m_layerComposited = true;
|
| }
|
|
|
| +
|
| +void DrawingBuffer::setIsHidden(bool hidden)
|
| +{
|
| + ASSERT(!m_destructionInProgress);
|
| + bool newHiddenValue = hidden || m_destructionInProgress;
|
| + if (m_isHidden == newHiddenValue)
|
| + return;
|
| +
|
| + m_isHidden = newHiddenValue;
|
| + if (m_isHidden)
|
| + freeRecycledMailboxes();
|
| +}
|
| +
|
| +void DrawingBuffer::freeRecycledMailboxes()
|
| +{
|
| + if (m_recycledMailboxQueue.isEmpty())
|
| + return;
|
| + m_context->makeContextCurrent();
|
| + while (!m_recycledMailboxQueue.isEmpty())
|
| + deleteMailbox(m_recycledMailboxQueue.takeLast());
|
| +}
|
| +
|
| blink::WebGraphicsContext3D* DrawingBuffer::context()
|
| {
|
| return m_context.get();
|
| @@ -192,7 +215,7 @@ blink::WebGraphicsContext3D* DrawingBuffer::context()
|
|
|
| bool DrawingBuffer::prepareMailbox(blink::WebExternalTextureMailbox* outMailbox, blink::WebExternalBitmap* bitmap)
|
| {
|
| - if (!m_contentsChanged)
|
| + if (!m_contentsChanged || m_isHidden)
|
| return false;
|
|
|
| if (m_destructionInProgress) {
|
| @@ -278,8 +301,8 @@ bool DrawingBuffer::prepareMailbox(blink::WebExternalTextureMailbox* outMailbox,
|
|
|
| void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mailbox)
|
| {
|
| - if (m_destructionInProgress) {
|
| - mailboxReleasedWhileDestructionInProgress(mailbox);
|
| + if (m_destructionInProgress || m_isHidden) {
|
| + mailboxReleasedWithoutRecycling(mailbox);
|
| return;
|
| }
|
|
|
| @@ -296,7 +319,7 @@ void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail
|
| ASSERT_NOT_REACHED();
|
| }
|
|
|
| -void DrawingBuffer::mailboxReleasedWhileDestructionInProgress(const blink::WebExternalTextureMailbox& mailbox)
|
| +void DrawingBuffer::mailboxReleasedWithoutRecycling(const blink::WebExternalTextureMailbox& mailbox)
|
| {
|
| ASSERT(m_textureMailboxes.size());
|
| m_context->makeContextCurrent();
|
|
|