本文整理汇总了C++中GrTexture::abandon方法的典型用法代码示例。如果您正苦于以下问题:C++ GrTexture::abandon方法的具体用法?C++ GrTexture::abandon怎么用?C++ GrTexture::abandon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrTexture
的用法示例。
在下文中一共展示了GrTexture::abandon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void Canvas2DLayerBridge::mailboxReleased(const WebExternalTextureMailbox& mailbox, bool lostResource)
{
bool contextLost = !m_isSurfaceValid || m_contextProvider->context3d()->isContextLost();
ASSERT(m_mailboxes.last().m_parentLayerBridge.get() == this);
// Mailboxes are typically released in FIFO order, so we iterate
// from the end of m_mailboxes.
auto releasedMailboxInfo = m_mailboxes.end();
auto firstMailbox = m_mailboxes.begin();
while (true) {
--releasedMailboxInfo;
if (nameEquals(releasedMailboxInfo->m_mailbox, mailbox)) {
break;
}
if (releasedMailboxInfo == firstMailbox) {
// Reached last entry without finding a match, should never happen.
// FIXME: This used to be an ASSERT, and was (temporarily?) changed to a
// CRASH to facilitate the investigation of crbug.com/443898.
CRASH();
}
}
if (!contextLost) {
// Invalidate texture state in case the compositor altered it since the copy-on-write.
if (releasedMailboxInfo->m_image) {
if (mailbox.syncPoint) {
context()->waitSyncPoint(mailbox.syncPoint);
}
GrTexture* texture = releasedMailboxInfo->m_image->getTexture();
if (texture) {
if (lostResource) {
texture->abandon();
} else {
texture->textureParamsModified();
}
}
}
}
RefPtr<Canvas2DLayerBridge> selfRef;
if (m_destructionInProgress) {
// To avoid memory use after free, take a scoped self-reference
// to postpone destruction until the end of this function.
selfRef = this;
}
// The destruction of 'releasedMailboxInfo' will:
// 1) Release the self reference held by the mailboxInfo, which may trigger
// the self-destruction of this Canvas2DLayerBridge
// 2) Release the SkImage, which will return the texture to skia's scratch
// texture pool.
m_mailboxes.remove(releasedMailboxInfo);
Canvas2DLayerManager::get().layerTransientResourceAllocationChanged(this);
}
示例2: ASSERT
void Canvas2DLayerBridge::mailboxReleased(const WebExternalTextureMailbox& mailbox, bool lostResource)
{
ASSERT(isAccelerated());
bool contextLost = !m_surface || m_contextProvider->context3d()->isContextLost();
ASSERT(m_mailboxes.last().m_parentLayerBridge.get() == this);
// Mailboxes are typically released in FIFO order, so we iterate
// from the end of m_mailboxes.
auto releasedMailboxInfo = m_mailboxes.end();
auto firstMailbox = m_mailboxes.begin();
while (true) {
--releasedMailboxInfo;
if (nameEquals(releasedMailboxInfo->m_mailbox, mailbox)) {
break;
}
ASSERT(releasedMailboxInfo != firstMailbox);
}
if (!contextLost) {
// Invalidate texture state in case the compositor altered it since the copy-on-write.
if (releasedMailboxInfo->m_image) {
if (mailbox.validSyncToken) {
context()->waitSyncToken(mailbox.syncToken);
}
GrTexture* texture = releasedMailboxInfo->m_image->getTexture();
if (texture) {
if (lostResource) {
texture->abandon();
} else {
texture->textureParamsModified();
}
}
}
}
RefPtr<Canvas2DLayerBridge> selfRef;
if (m_destructionInProgress) {
// To avoid memory use after free, take a scoped self-reference
// to postpone destruction until the end of this function.
selfRef = this;
}
// The destruction of 'releasedMailboxInfo' will:
// 1) Release the self reference held by the mailboxInfo, which may trigger
// the self-destruction of this Canvas2DLayerBridge
// 2) Release the SkImage, which will return the texture to skia's scratch
// texture pool.
m_mailboxes.remove(releasedMailboxInfo);
}