| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 if (!mailboxInfo) | 310 if (!mailboxInfo) |
| 311 return; | 311 return; |
| 312 | 312 |
| 313 ASSERT(mailboxInfo->m_status == MailboxReleased); | 313 ASSERT(mailboxInfo->m_status == MailboxReleased); |
| 314 if (mailboxInfo->m_mailbox.syncPoint) { | 314 if (mailboxInfo->m_mailbox.syncPoint) { |
| 315 context()->waitSyncPoint(mailboxInfo->m_mailbox.syncPoint); | 315 context()->waitSyncPoint(mailboxInfo->m_mailbox.syncPoint); |
| 316 mailboxInfo->m_mailbox.syncPoint = 0; | 316 mailboxInfo->m_mailbox.syncPoint = 0; |
| 317 } | 317 } |
| 318 // Invalidate texture state in case the compositor altered it since the copy
-on-write. | 318 // Invalidate texture state in case the compositor altered it since the copy
-on-write. |
| 319 if (mailboxInfo->m_image) { | 319 if (mailboxInfo->m_image) { |
| 320 if (isHidden() || releasedMailboxHasExpired()) | |
| 321 mailboxInfo->m_image->getTexture()->resetFlag(static_cast<GrTextureF
lags>(GrTexture::kReturnToCache_FlagBit)); | |
| 322 mailboxInfo->m_image->getTexture()->textureParamsModified(); | 320 mailboxInfo->m_image->getTexture()->textureParamsModified(); |
| 323 mailboxInfo->m_image.clear(); | 321 mailboxInfo->m_image.clear(); |
| 324 } | 322 } |
| 325 mailboxInfo->m_status = MailboxAvailable; | 323 mailboxInfo->m_status = MailboxAvailable; |
| 326 m_releasedMailboxInfoIndex = InvalidMailboxIndex; | 324 m_releasedMailboxInfoIndex = InvalidMailboxIndex; |
| 327 Canvas2DLayerManager::get().layerTransientResourceAllocationChanged(this); | 325 Canvas2DLayerManager::get().layerTransientResourceAllocationChanged(this); |
| 328 } | 326 } |
| 329 | 327 |
| 330 WebGraphicsContext3D* Canvas2DLayerBridge::context() | 328 WebGraphicsContext3D* Canvas2DLayerBridge::context() |
| 331 { | 329 { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // No need to clean up the mailbox resource, but make sure the | 496 // No need to clean up the mailbox resource, but make sure the |
| 499 // mailbox can also be reusable once the context is restored. | 497 // mailbox can also be reusable once the context is restored. |
| 500 mailboxInfo->m_status = MailboxAvailable; | 498 mailboxInfo->m_status = MailboxAvailable; |
| 501 m_releasedMailboxInfoIndex = InvalidMailboxIndex; | 499 m_releasedMailboxInfoIndex = InvalidMailboxIndex; |
| 502 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); | 500 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); |
| 503 } else if (lostResource) { | 501 } else if (lostResource) { |
| 504 // In case of the resource is lost, we need to delete the backin
g | 502 // In case of the resource is lost, we need to delete the backin
g |
| 505 // texture and remove the mailbox from list to avoid reusing it | 503 // texture and remove the mailbox from list to avoid reusing it |
| 506 // in future. | 504 // in future. |
| 507 if (mailboxInfo->m_image) { | 505 if (mailboxInfo->m_image) { |
| 508 mailboxInfo->m_image->getTexture()->resetFlag( | 506 GrTexture* texture = mailboxInfo->m_image->getTexture(); |
| 509 static_cast<GrTextureFlags>(GrTexture::kReturnToCache_Fl
agBit)); | 507 if (texture) |
| 510 mailboxInfo->m_image->getTexture()->textureParamsModified(); | 508 texture->textureParamsModified(); |
| 511 mailboxInfo->m_image.clear(); | 509 mailboxInfo->m_image.clear(); |
| 512 } | 510 } |
| 513 size_t i = mailboxInfo - m_mailboxes.begin(); | 511 size_t i = mailboxInfo - m_mailboxes.begin(); |
| 514 m_mailboxes.remove(i); | 512 m_mailboxes.remove(i); |
| 515 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); | 513 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); |
| 516 // Here we need to return early since mailboxInfo removal would | 514 // Here we need to return early since mailboxInfo removal would |
| 517 // also clear m_parentLayerBridge reference. | 515 // also clear m_parentLayerBridge reference. |
| 518 return; | 516 return; |
| 519 } else { | 517 } else { |
| 520 mailboxInfo->m_status = MailboxReleased; | 518 mailboxInfo->m_status = MailboxReleased; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // This copy constructor should only be used for Vector reallocation | 567 // This copy constructor should only be used for Vector reallocation |
| 570 // Assuming 'other' is to be destroyed, we transfer m_image and | 568 // Assuming 'other' is to be destroyed, we transfer m_image and |
| 571 // m_parentLayerBridge ownership rather than do a refcount dance. | 569 // m_parentLayerBridge ownership rather than do a refcount dance. |
| 572 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 570 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
| 573 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 571 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
| 574 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); | 572 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); |
| 575 m_status = other.m_status; | 573 m_status = other.m_status; |
| 576 } | 574 } |
| 577 | 575 |
| 578 } // namespace blink | 576 } // namespace blink |
| OLD | NEW |