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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
Index: cc/trees/layer_tree_host.cc
===================================================================
--- cc/trees/layer_tree_host.cc (revision 210393)
+++ cc/trees/layer_tree_host.cc (working copy)
@@ -73,7 +73,8 @@
LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
const LayerTreeSettings& settings)
- : animating_(false),
+ : ui_resource_counter_(1),
+ animating_(false),
needs_full_tree_sync_(true),
needs_filter_context_(false),
client_(client),
@@ -96,6 +97,7 @@
partial_texture_update_requests_(0),
in_paint_layer_contents_(false),
total_frames_used_for_lcd_text_metrics_(0) {
+
aelias_OOO_until_Jul13 2013/07/10 23:07:22 nit: accidental whitespace
powei 2013/07/11 23:54:44 Done.
if (settings_.accelerated_animation_enabled)
animation_registrar_ = AnimationRegistrar::Create();
s_num_layer_tree_instances++;
@@ -252,6 +254,7 @@
// If there are linked evicted backings, these backings' resources may be put
// into the impl tree, so we can't draw yet. Determine this before clearing
// all evicted backings.
+
aelias_OOO_until_Jul13 2013/07/10 23:07:22 nit: accidental whitespace
powei 2013/07/11 23:54:44 Done.
bool new_impl_tree_has_no_evicted_resources = false;
if (contents_texture_manager_) {
new_impl_tree_has_no_evicted_resources =
@@ -349,6 +352,19 @@
pending_page_scale_animation_.reset();
}
+ // ui resource processing
aelias_OOO_until_Jul13 2013/07/10 23:07:22 Delete this comment
powei 2013/07/11 23:54:44 Done.
+ while (ui_resource_request_queue_.size() > 0) {
+ UIResourceRequest req = ui_resource_request_queue_.front();
+ ui_resource_request_queue_.pop_front();
+ host_impl->CreateUIResource(req.id, req.bitmap, req.async);
+ }
+
+ while (ui_resource_remove_queue_.size() > 0) {
+ UIResourceId uid = ui_resource_remove_queue_.front();
+ ui_resource_remove_queue_.pop_front();
+ host_impl->DeleteUIResource(uid);
+ }
+
DCHECK(!sync_tree->ViewportSizeInvalid());
if (new_impl_tree_has_no_evicted_resources) {
@@ -1055,4 +1071,35 @@
return proxy_->CapturePicture();
}
+UIResourceId
+LayerTreeHost::CreateUIResource(scoped_refptr<UIResourceBitmap> bitmap,
+ UIResourceManagerClient* client) {
+ UIResourceRequest request;
+ request.id = ui_resource_counter_++;
+ request.bitmap = bitmap;
+ request.async = true;
+
+ ui_resource_request_queue_.push_back(request);
+ ui_resource_client_map_[request.id] = client;
+
+ return request.id;
+}
+
+// Deletes a UI resource. May safely be called more than once.
+void LayerTreeHost::DeleteUIResource(UIResourceId uid) {
+ if (ui_resource_client_map_.find(uid) != ui_resource_client_map_.end()) {
+ ui_resource_remove_queue_.push_back(uid);
+ ui_resource_client_map_.erase(uid);
+ }
+}
+
+void LayerTreeHost::UIResourceReady(UIResourceId id) {
+ if (ui_resource_client_map_.find(id) != ui_resource_client_map_.end()) {
+ ui_resource_client_map_[id]->UIResourceReady(id);
+ }
+}
+
+void LayerTreeHost::UIResourceLost(UIResourceId id) {}
+
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698