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

Unified Diff: cc/layers/layer_impl.cc

Issue 61883006: Compositor thread plumbing for layout rectangle debug info. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO, fixed nits. Created 7 years 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/layer_impl.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index f8882291dd32f9a0b1e6451b0d23485091f77786..092300b08a48725f889f57bd823b3d830465d498 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -5,6 +5,7 @@
#include "cc/layers/layer_impl.h"
#include "base/debug/trace_event.h"
+#include "base/json/json_reader.h"
#include "base/strings/stringprintf.h"
#include "cc/animation/animation_registrar.h"
#include "cc/animation/scrollbar_animation_controller.h"
@@ -155,6 +156,11 @@ void LayerImpl::SetScrollParent(LayerImpl* parent) {
scroll_parent_ = parent;
}
+void LayerImpl::SetDebugInfo(
+ scoped_refptr<base::debug::ConvertableToTraceFormat> other) {
+ debug_info_ = other;
+}
+
void LayerImpl::SetScrollChildren(std::set<LayerImpl*>* children) {
if (scroll_children_.get() == children)
return;
@@ -590,6 +596,8 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
// Reset any state that should be cleared for the next update.
stacking_order_changed_ = false;
update_rect_ = gfx::RectF();
+
+ layer->SetDebugInfo(debug_info_);
}
base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
@@ -1364,6 +1372,19 @@ void LayerImpl::AsValueInto(base::DictionaryValue* state) const {
if (layer_animation_controller_->AnimatedBoundsForBox(box, &inflated))
state->Set("animated_bounds", MathUtil::AsValue(inflated).release());
}
+
+ if (debug_info_.get()) {
+ std::string str;
+ debug_info_->AppendAsTraceFormat(&str);
+ base::JSONReader json_reader;
+ // Parsing the JSON and re-encoding it is not very efficient,
+ // but it's the simplest way to achieve the desired effect, which
+ // is to output:
+ // {..., layout_rects: [{geometry_rect: ...}, ...], ...}
+ // rather than:
+ // {layout_rects: "[{geometry_rect: ...}, ...]", ...}
+ state->Set("layout_rects", json_reader.ReadToValue(str));
+ }
}
size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; }
« no previous file with comments | « cc/layers/layer_impl.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698