cc: Fix nine patch layer resource management bugs.
This switches back to using if (m_resource) in pushPropertiesTo() since it may be called before setNeedsDisplay(). Also, switch to checking if resourceId == 0 instead of backingResourceIsDeleted() since that asserts it's only called on the impl thread. Review URL: https://chromiumcodereview.appspot.com/11377017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166399 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -63,7 +63,7 @@ void NinePatchLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*
|
||||
{
|
||||
createUpdaterIfNeeded();
|
||||
|
||||
if (m_resource && (m_bitmapDirty || m_resource->texture()->backingResourceWasEvicted())) {
|
||||
if (m_resource && (m_bitmapDirty || m_resource->texture()->resourceId() == 0)) {
|
||||
gfx::Rect contentRect(gfx::Point(), gfx::Size(m_bitmap.width(), m_bitmap.height()));
|
||||
ResourceUpdate upload = ResourceUpdate::Create(m_resource->texture(), &m_bitmap, contentRect, contentRect, gfx::Vector2d());
|
||||
queue.appendFullUpload(upload);
|
||||
@ -90,10 +90,11 @@ void NinePatchLayer::pushPropertiesTo(LayerImpl* layer)
|
||||
Layer::pushPropertiesTo(layer);
|
||||
NinePatchLayerImpl* layerImpl = static_cast<NinePatchLayerImpl*>(layer);
|
||||
|
||||
DCHECK(!m_bitmap.isNull());
|
||||
DCHECK(m_resource);
|
||||
layerImpl->setResourceId(m_resource->texture()->resourceId());
|
||||
layerImpl->setLayout(gfx::Size(m_bitmap.width(), m_bitmap.height()), m_imageAperture);
|
||||
if (m_resource) {
|
||||
DCHECK(!m_bitmap.isNull());
|
||||
layerImpl->setResourceId(m_resource->texture()->resourceId());
|
||||
layerImpl->setLayout(gfx::Size(m_bitmap.width(), m_bitmap.height()), m_imageAperture);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -116,10 +116,7 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap)
|
||||
|
||||
// Nothing changed, so no repeated upload.
|
||||
testLayer->setTexturePriorities(calculator);
|
||||
{
|
||||
DebugScopedSetImplThread implThread;
|
||||
testLayer->update(queue, &occlusionTracker, stats);
|
||||
}
|
||||
testLayer->update(queue, &occlusionTracker, stats);
|
||||
EXPECT_EQ(queue.fullUploadSize(), 0);
|
||||
EXPECT_EQ(queue.partialUploadSize(), 0);
|
||||
|
||||
@ -131,10 +128,7 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap)
|
||||
|
||||
// Reupload after eviction
|
||||
testLayer->setTexturePriorities(calculator);
|
||||
{
|
||||
DebugScopedSetImplThread implThread;
|
||||
testLayer->update(queue, &occlusionTracker, stats);
|
||||
}
|
||||
testLayer->update(queue, &occlusionTracker, stats);
|
||||
EXPECT_EQ(queue.fullUploadSize(), 1);
|
||||
EXPECT_EQ(queue.partialUploadSize(), 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user