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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // in future. | 509 // in future. |
510 if (mailboxInfo->m_image) { | 510 if (mailboxInfo->m_image) { |
511 mailboxInfo->m_image->getTexture()->resetFlag( | 511 mailboxInfo->m_image->getTexture()->resetFlag( |
512 static_cast<GrTextureFlags>(GrTexture::kReturnToCache_Fl
agBit)); | 512 static_cast<GrTextureFlags>(GrTexture::kReturnToCache_Fl
agBit)); |
513 mailboxInfo->m_image->getTexture()->textureParamsModified(); | 513 mailboxInfo->m_image->getTexture()->textureParamsModified(); |
514 mailboxInfo->m_image.clear(); | 514 mailboxInfo->m_image.clear(); |
515 } | 515 } |
516 size_t i = mailboxInfo - m_mailboxes.begin(); | 516 size_t i = mailboxInfo - m_mailboxes.begin(); |
517 m_mailboxes.remove(i); | 517 m_mailboxes.remove(i); |
518 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); | 518 Canvas2DLayerManager::get().layerTransientResourceAllocationChan
ged(this); |
| 519 // Here we need to return early since mailboxInfo removal would |
| 520 // also clear m_parentLayerBridge reference. |
| 521 return; |
519 } else { | 522 } else { |
520 mailboxInfo->m_status = MailboxReleased; | 523 mailboxInfo->m_status = MailboxReleased; |
521 m_releasedMailboxInfoIndex = mailboxInfo - m_mailboxes.begin(); | 524 m_releasedMailboxInfoIndex = mailboxInfo - m_mailboxes.begin(); |
522 m_framesSinceMailboxRelease = 0; | 525 m_framesSinceMailboxRelease = 0; |
523 if (isHidden()) { | 526 if (isHidden()) { |
524 freeReleasedMailbox(); | 527 freeReleasedMailbox(); |
525 } else { | 528 } else { |
526 ASSERT(!m_destructionInProgress); | 529 ASSERT(!m_destructionInProgress); |
527 Canvas2DLayerManager::get().layerTransientResourceAllocation
Changed(this); | 530 Canvas2DLayerManager::get().layerTransientResourceAllocation
Changed(this); |
528 } | 531 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { | 570 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { |
568 // This copy constructor should only be used for Vector reallocation | 571 // This copy constructor should only be used for Vector reallocation |
569 // Assuming 'other' is to be destroyed, we transfer m_image ownership | 572 // Assuming 'other' is to be destroyed, we transfer m_image ownership |
570 // rather than do a refcount dance. | 573 // rather than do a refcount dance. |
571 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 574 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
572 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 575 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
573 m_status = other.m_status; | 576 m_status = other.m_status; |
574 } | 577 } |
575 | 578 |
576 } | 579 } |
OLD | NEW |