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

Unified Diff: cc/layers/painted_scrollbar_layer.cc

Issue 537943003: Releasing Track & Thumb UIResources based on their Geometry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Releasing Track & Thumb UIResources based on their Geometry Created 6 years, 3 months 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 | « cc/layers/painted_scrollbar_layer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/painted_scrollbar_layer.cc
diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc
index 7062bc1e9bade7910cde353e5be9697cd9922e80..9208bfcce04f5f6c630b48864e153db2b756a001 100644
--- a/cc/layers/painted_scrollbar_layer.cc
+++ b/cc/layers/painted_scrollbar_layer.cc
@@ -130,8 +130,12 @@ void PaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
if (track_resource_.get())
scrollbar_layer->set_track_ui_resource_id(track_resource_->id());
+ else
+ scrollbar_layer->set_track_ui_resource_id(0);
if (thumb_resource_.get())
scrollbar_layer->set_thumb_ui_resource_id(thumb_resource_->id());
+ else
+ scrollbar_layer->set_thumb_ui_resource_id(0);
scrollbar_layer->set_is_overlay_scrollbar(is_overlay_);
}
@@ -196,6 +200,17 @@ void PaintedScrollbarLayer::UpdateThumbAndTrackGeometry() {
UpdateProperty(0, &thumb_thickness_);
UpdateProperty(0, &thumb_length_);
}
+ ReleaseThumbAndTrackUIResourcesIfNecessary();
+}
+
+void PaintedScrollbarLayer::ReleaseThumbAndTrackUIResourcesIfNecessary() {
+ if (track_rect_.IsEmpty() && track_resource_) {
+ track_resource_.reset();
+ SetNeedsPushProperties();
+ } else if ((!has_thumb_ || track_rect_.IsEmpty()) && thumb_resource_) {
+ thumb_resource_.reset();
+ SetNeedsPushProperties();
danakj 2014/09/04 16:38:10 these need to make Update() return true also, so I
MuVen 2014/09/05 14:44:13 Done.Tests Added.
+ }
}
bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue,
« no previous file with comments | « cc/layers/painted_scrollbar_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698