Skip to content

Commit

Permalink
WebGL: Be less aggressive about pruning image backed mailboxes.
Browse files Browse the repository at this point in the history
Creating an image backed mailbox can be quite expensive.

BUG=581777

Review-Url: https://codereview.chromium.org/2089293002
Cr-Commit-Position: refs/heads/master@{#401489}
  • Loading branch information
erikchen authored and Commit bot committed Jun 23, 2016
1 parent da9e511 commit 464a53b
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,18 @@ PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::recycledMailbox()
if (m_recycledMailboxQueue.isEmpty())
return PassRefPtr<MailboxInfo>();

// Creation of image backed mailboxes is very expensive, so be less
// aggressive about pruning them.
size_t cacheLimit = 1;
if (RuntimeEnabledFeatures::webGLImageChromiumEnabled())
cacheLimit = 4;

WebExternalTextureMailbox mailbox;
while (!m_recycledMailboxQueue.isEmpty()) {
while (m_recycledMailboxQueue.size() > cacheLimit) {
mailbox = m_recycledMailboxQueue.takeLast();
// Never have more than one mailbox in the released state.
if (!m_recycledMailboxQueue.isEmpty())
deleteMailbox(mailbox);
deleteMailbox(mailbox);
}
mailbox = m_recycledMailboxQueue.takeLast();

RefPtr<MailboxInfo> mailboxInfo;
for (size_t i = 0; i < m_textureMailboxes.size(); i++) {
Expand Down

0 comments on commit 464a53b

Please sign in to comment.