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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 375093002: Initial attempt at counting layers in the compositor thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add UMA for number of layers in a compositor frame Created 6 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_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 088d56df6a7a0c4f67f790f8e42e6433b9d7f590..53342292aea24d0d638c472af60fae77a5334601 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -114,6 +114,10 @@ unsigned GetMapImageTextureTarget(cc::ContextProvider* context_provider) {
return GL_TEXTURE_2D;
}
+void LayerCounter(size_t* counter, cc::LayerImpl* /* layer */) {
danakj 2014/07/10 18:03:41 we don't comment out parameter names in chrome
+ (*counter)++;
+}
+
} // namespace
namespace cc {
@@ -255,7 +259,8 @@ LayerTreeHostImpl::LayerTreeHostImpl(
#endif
shared_bitmap_manager_(manager),
id_(id),
- transfer_buffer_memory_limit_(0u) {
+ transfer_buffer_memory_limit_(0u),
+ num_layers_(0u) {
DCHECK(proxy_->IsImplThread());
DidVisibilityChange(this, visible_);
animation_registrar_->set_supports_scroll_animations(
@@ -1099,6 +1104,16 @@ DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
}
need_to_update_visible_tiles_before_draw_ = true;
+ {
+ // Count the number of layers. See http://crbug.com/253919
+ // A large number of layers might slow down rendering.
+ num_layers_ = 0;
danakj 2014/07/10 18:03:41 While I love tests, I don't think we need to add a
Ian Vollick 2014/07/10 18:09:50 Ah, cool! That's a great idea. If we can use that
dneto 2014/07/10 18:44:16 Yes, that's smart! I don't know the data structur
+ LayerTreeHostCommon::CallFunctionForSubtree<LayerImpl>(
+ active_tree_->root_layer(), base::Bind(LayerCounter, &num_layers_));
Ian Vollick 2014/07/10 03:16:23 I'm a bit worried about doing an extra tree walk e
dneto 2014/07/10 18:44:16 I'll rework it one way or another.
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Compositing.NumLayers", num_layers_, 1, 1000, 50);
dneto 2014/07/10 01:29:03 Also not sure if range of 1000 and width-20 bucket
Ian Vollick 2014/07/10 03:16:22 This is probably ok. width-10 buckets might be nic
dneto 2014/07/10 18:44:16 Ok. I'll make width-10 buckets with a range up t
+ }
+
bool ok = active_tree_->UpdateDrawProperties();
DCHECK(ok) << "UpdateDrawProperties failed during draw";

Powered by Google App Engine
This is Rietveld 408576698