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

Unified Diff: cc/blink/blink_layer_debug_info.cc

Issue 474783002: HUD: Show first paint invalidation in red (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compilefix 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/blink/blink_layer_debug_info.h ('k') | cc/blink/cc_blink.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blink/blink_layer_debug_info.cc
diff --git a/cc/blink/blink_layer_debug_info.cc b/cc/blink/blink_layer_debug_info.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fc0811f06acc6804832ef98754fa3b0b32181d68
--- /dev/null
+++ b/cc/blink/blink_layer_debug_info.cc
@@ -0,0 +1,73 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/blink/blink_layer_debug_info.h"
+
+#include "cc/base/math_util.h"
+#include "cc/debug/debug_rect_history.h"
+#include "cc/layers/layer.h"
+#include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h"
+#include "third_party/WebKit/public/platform/WebInvalidationDebugAnnotations.h"
+#include "third_party/WebKit/public/platform/WebVector.h"
+#include "ui/gfx/geometry/rect_conversions.h"
+
+namespace cc_blink {
+
+BlinkLayerDebugInfo::BlinkLayerDebugInfo(
+ blink::WebGraphicsLayerDebugInfo* debug_info)
+ : debug_info_(debug_info) {
+}
+
+BlinkLayerDebugInfo::~BlinkLayerDebugInfo() {
+}
+
+void BlinkLayerDebugInfo::AppendAsTraceFormat(std::string* out) const {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ blink::WebString web_string;
+ debug_info_->appendAsTraceFormat(&web_string);
+ out->append(web_string.utf8());
+}
+
+namespace {
+
+cc::DebugRectType WebInvalidationDebugAnnotationsToDebugRectType(
+ blink::WebInvalidationDebugAnnotations annotations) {
+ if (annotations == blink::WebInvalidationDebugAnnotationsFirstPaint) {
+ return cc::FIRST_PAINT_RECT_TYPE;
+ }
+
+ return cc::PAINT_RECT_TYPE;
+}
+
+} // namespace
+
+std::vector<cc::DebugRect> BlinkLayerDebugInfo::GetInvalidationRects(
+ cc::Layer* layer) const {
+ std::vector<cc::DebugRect> rects;
+
+ blink::WebVector<blink::WebAnnotatedInvalidationRect> web_rects;
+ debug_info_->getAnnotatedInvalidationRects(web_rects);
+
+ float width_scale = layer->content_bounds().width() /
+ static_cast<float>(layer->bounds().width());
+ float height_scale = layer->content_bounds().height() /
+ static_cast<float>(layer->bounds().height());
+
+ rects.reserve(web_rects.size());
+ for (size_t i = 0; i < web_rects.size(); ++i) {
+ const blink::WebAnnotatedInvalidationRect& web_rect = web_rects[i];
+ cc::DebugRectType type =
+ WebInvalidationDebugAnnotationsToDebugRectType(web_rect.annotations);
+
+ gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect(
+ gfx::ToEnclosingRect(web_rect.rect), width_scale, height_scale);
+ gfx::Rect screen_space_rect = cc::MathUtil::MapEnclosingClippedRect(
+ layer->screen_space_transform(), update_content_rect);
+ rects.push_back(cc::DebugRect(type, screen_space_rect));
+ }
+
+ return rects;
+}
+
+} // namespace cc_blink
« no previous file with comments | « cc/blink/blink_layer_debug_info.h ('k') | cc/blink/cc_blink.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698