Commit d74ca3b2 authored by jamesr@chromium.org's avatar jamesr@chromium.org

Roll in CC changes up to 128196

Specifically this brings in r128196 and 128005

BUG=


Review URL: https://chromiumcodereview.appspot.com/10919227

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156412 0039d316-1c4b-4281-b951-d872f2087c98
parent 0005f372
......@@ -394,11 +394,18 @@ void CCLayerTreeHost::setVisible(bool visible)
m_proxy->setVisible(visible);
}
void CCLayerTreeHost::evictAllContentTextures()
void CCLayerTreeHost::unlinkAllContentTextures()
{
ASSERT(CCProxy::isMainThread());
ASSERT(m_contentsTextureManager.get());
m_contentsTextureManager->allBackingTexturesWereDeleted();
m_contentsTextureManager->unlinkAllBackings();
}
void CCLayerTreeHost::deleteUnlinkedTextures()
{
ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
ASSERT(m_contentsTextureManager.get());
m_contentsTextureManager->deleteAllUnlinkedBackings();
}
void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
......
......@@ -191,11 +191,8 @@ public:
CCPrioritizedTextureManager* contentsTextureManager() const;
// This will cause contents texture manager to evict all textures, but
// without deleting them. This happens after all content textures have
// already been deleted on impl, after getting a 0 allocation limit.
// Set during a commit, but before updateLayers.
void evictAllContentTextures();
void unlinkAllContentTextures();
void deleteUnlinkedTextures();
bool visible() const { return m_visible; }
void setVisible(bool);
......
......@@ -228,6 +228,8 @@ void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvi
void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider)
{
ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
ASSERT(resourceProvider);
// Unlink and destroy all backing textures.
while (m_backings.size() > 0) {
BackingSet::iterator it = m_backings.begin();
......@@ -237,12 +239,24 @@ void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourcePro
}
}
void CCPrioritizedTextureManager::allBackingTexturesWereDeleted()
void CCPrioritizedTextureManager::unlinkAllBackings()
{
ASSERT(CCProxy::isMainThread());
for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it)
if ((*it)->owner())
(*it)->owner()->unlink();
}
void CCPrioritizedTextureManager::deleteAllUnlinkedBackings()
{
// Same as clearAllMemory, except all our textures were already
// deleted externally, so we don't delete them. Passing no
// resourceProvider results in leaking the (now invalid) texture ids.
clearAllMemory(0);
ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
BackingVector backingsToDelete;
for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it)
if (!(*it)->owner())
backingsToDelete.append((*it));
for (BackingVector::iterator it = backingsToDelete.begin(); it != backingsToDelete.end(); ++it)
destroyBacking((*it), 0);
}
void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture)
......
......@@ -58,7 +58,8 @@ public:
void reduceMemory(CCResourceProvider*);
void clearAllMemory(CCResourceProvider*);
void allBackingTexturesWereDeleted();
void unlinkAllBackings();
void deleteAllUnlinkedBackings();
void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*);
......
......@@ -420,6 +420,7 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter
paint.setImageFilter(zoomFilter.get());
canvas->saveLayer(0, &paint);
canvas->drawBitmap(state.source(), 0, 0);
canvas->restore();
break;
}
case WebKit::WebFilterOperation::FilterTypeBrightness:
......
......@@ -134,6 +134,7 @@ bool CCSingleThreadProxy::recreateContext()
bool initialized;
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
DebugScopedSetImplThread impl;
if (!m_layerTreeHostImpl->contentsTexturesPurged())
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
......@@ -276,12 +277,14 @@ bool CCSingleThreadProxy::commitAndComposite()
{
ASSERT(CCProxy::isMainThread());
if (!m_layerTreeHost->initializeRendererIfNeeded())
return false;
if (m_layerTreeHostImpl->contentsTexturesPurged())
m_layerTreeHost->evictAllContentTextures();
if (m_layerTreeHostImpl->contentsTexturesPurged()) {
m_layerTreeHost->unlinkAllContentTextures();
DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked;
m_layerTreeHost->deleteUnlinkedTextures();
}
CCTextureUpdateQueue queue;
m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLimitBytes());
......
......@@ -528,7 +528,7 @@ void CCThreadProxy::beginFrame()
}
if (request->contentsTexturesWereDeleted)
m_layerTreeHost->evictAllContentTextures();
m_layerTreeHost->unlinkAllContentTextures();
OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue);
m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes);
......@@ -570,7 +570,7 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
{
TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread");
ASSERT(!m_commitCompletionEventOnImplThread);
ASSERT(isImplThread());
ASSERT(isImplThread() && isMainThreadBlocked());
ASSERT(m_schedulerOnImplThread);
ASSERT(m_schedulerOnImplThread->commitPending());
......@@ -580,15 +580,20 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
return;
}
if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPurged()) {
if (contentsTexturesWereDeleted) {
ASSERT(m_layerTreeHostImpl->contentsTexturesPurged());
// We unlinked all textures on the main thread, delete them now.
m_layerTreeHost->deleteUnlinkedTextures();
// Mark that we can start drawing again when this commit is complete.
m_resetContentsTexturesPurgedAfterCommitOnImplThread = true;
} else if (m_layerTreeHostImpl->contentsTexturesPurged()) {
// We purged the content textures on the impl thread between the time we
// posted the beginFrame task and now, meaning we have a bunch of
// uploads that are now invalid. Clear the uploads (they all go to
// content textures), and kick another commit to fill them again.
queue->clearUploads();
setNeedsCommitOnImplThread();
} else
m_resetContentsTexturesPurgedAfterCommitOnImplThread = true;
}
m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader());
m_commitCompletionEventOnImplThread = completion;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment