Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1701)

Unified Diff: cc/nine_patch_layer.cc

Issue 11377017: cc: Fix nine patch layer resource management bugs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/nine_patch_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/nine_patch_layer.cc
diff --git a/cc/nine_patch_layer.cc b/cc/nine_patch_layer.cc
index 8ad31742a094364aee92b1752af3906d5f533a4f..5ab5ffe1bb859587b3a5d3c352453f28613c108a 100644
--- a/cc/nine_patch_layer.cc
+++ b/cc/nine_patch_layer.cc
@@ -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);
+ }
}
}
« no previous file with comments | « no previous file | cc/nine_patch_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698