| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // mailbox can also be reusable once the context is restored. | 504 // mailbox can also be reusable once the context is restored. |
| 505 mailboxInfo->m_status = MailboxAvailable; | 505 mailboxInfo->m_status = MailboxAvailable; |
| 506 m_releasedMailboxInfoIndex = InvalidMailboxIndex; | 506 m_releasedMailboxInfoIndex = InvalidMailboxIndex; |
| 507 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); | 507 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); |
| 508 } else if (lostResource) { | 508 } else if (lostResource) { |
| 509 // In case of the resource is lost, we need to delete the backin
g | 509 // In case of the resource is lost, we need to delete the backin
g |
| 510 // texture and remove the mailbox from list to avoid reusing it | 510 // texture and remove the mailbox from list to avoid reusing it |
| 511 // in future. | 511 // in future. |
| 512 if (mailboxInfo->m_image) { | 512 if (mailboxInfo->m_image) { |
| 513 GrTexture* texture = mailboxInfo->m_image->getTexture(); | 513 GrTexture* texture = mailboxInfo->m_image->getTexture(); |
| 514 if (texture) { | 514 if (texture) |
| 515 texture->resetFlag(static_cast<GrTextureFlags>(GrTexture
::kReturnToCache_FlagBit)); | |
| 516 texture->textureParamsModified(); | 515 texture->textureParamsModified(); |
| 517 } | |
| 518 mailboxInfo->m_image.clear(); | 516 mailboxInfo->m_image.clear(); |
| 519 } | 517 } |
| 520 if (m_destructionInProgress) { | 518 if (m_destructionInProgress) { |
| 521 mailboxInfo->m_status = MailboxAvailable; // To satisfy asse
rt in destructor | 519 mailboxInfo->m_status = MailboxAvailable; // To satisfy asse
rt in destructor |
| 522 | 520 |
| 523 // The following line may trigger self destruction. We do no
t care about | 521 // The following line may trigger self destruction. We do no
t care about |
| 524 // not cleaning up m_mailboxes during destruction sequence b
ecause | 522 // not cleaning up m_mailboxes during destruction sequence b
ecause |
| 525 // mailboxes will not be recycled after this point. Calling
remove() | 523 // mailboxes will not be recycled after this point. Calling
remove() |
| 526 // could trigger a memory use after free, so we just clear t
he self | 524 // could trigger a memory use after free, so we just clear t
he self |
| 527 // reference to be safe, and we let the Canvas2DLayerBridge
destructor | 525 // reference to be safe, and we let the Canvas2DLayerBridge
destructor |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 // This copy constructor should only be used for Vector reallocation | 590 // This copy constructor should only be used for Vector reallocation |
| 593 // Assuming 'other' is to be destroyed, we transfer m_image and | 591 // Assuming 'other' is to be destroyed, we transfer m_image and |
| 594 // m_parentLayerBridge ownership rather than do a refcount dance. | 592 // m_parentLayerBridge ownership rather than do a refcount dance. |
| 595 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 593 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
| 596 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 594 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
| 597 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); | 595 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); |
| 598 m_status = other.m_status; | 596 m_status = other.m_status; |
| 599 } | 597 } |
| 600 | 598 |
| 601 } // namespace blink | 599 } // namespace blink |
| OLD | NEW |