Index: Source/platform/graphics/gpu/DrawingBuffer.cpp |
diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp |
index 8927cd7eb2ea07757d87929eff452128fe81650e..79f385846f069e6d94c61171a002bcd29dae9d30 100644 |
--- a/Source/platform/graphics/gpu/DrawingBuffer.cpp |
+++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp |
@@ -147,6 +147,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. |
@@ -184,6 +185,25 @@ void DrawingBuffer::markLayerComposited() |
m_layerComposited = true; |
} |
+ |
+void DrawingBuffer::setIsHidden(bool hidden) |
Ken Russell (switch to Gerrit)
2014/04/28 20:51:45
What happens when the DrawingBuffer is un-hidden?
dshwang
2014/04/29 16:07:04
When un-hidden, DrawingBuffer recreate mailbox for
|
+{ |
+ ASSERT(!m_destructionInProgress); |
+ bool newHiddenValue = hidden || m_destructionInProgress; |
+ if (m_isHidden == newHiddenValue) |
+ return; |
+ |
+ m_isHidden = newHiddenValue; |
+ if (m_isHidden) |
+ freeRecycledMailboxes(); |
Justin Novosad
2014/04/28 15:21:42
This is a good start. Eventually we should experim
Ken Russell (switch to Gerrit)
2014/04/28 20:51:45
zmo@ is actively working on deciding when to evict
dshwang
2014/04/29 16:07:04
IMO, it's not overlapped with evicting contexts. T
|
+} |
+ |
+void DrawingBuffer::freeRecycledMailboxes() |
+{ |
+ while (!m_recycledMailboxQueue.isEmpty()) |
+ deleteMailbox(m_recycledMailboxQueue.takeLast()); |
+} |
+ |
blink::WebGraphicsContext3D* DrawingBuffer::context() |
{ |
return m_context.get(); |
@@ -191,7 +211,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) { |
@@ -274,8 +294,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; |
} |
@@ -292,7 +312,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(); |