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

Unified Diff: ui/compositor/compositor.cc

Issue 2795703002: ui: Add debug flag to show composited layer borders in ChromeOS UI. (Closed)
Patch Set: nits Created 3 years, 8 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 | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index b83b08feeae9720452a7df762f0b8dbd7b040c03..fdb19d7ecae3de4870a7bce200f4e4addbfc6749 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -15,6 +15,7 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/sys_info.h"
#include "base/trace_event/trace_event.h"
@@ -108,9 +109,33 @@ Compositor::Compositor(const cc::FrameSinkId& frame_sink_id,
settings.renderer_settings.show_overdraw_feedback =
command_line->HasSwitch(cc::switches::kShowOverdrawFeedback);
- // These flags should be mirrored by renderer versions in content/renderer/.
- settings.initial_debug_state.show_debug_borders =
- command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders);
+ if (command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders)) {
+ std::string layer_borders_string = command_line->GetSwitchValueASCII(
+ cc::switches::kUIShowCompositedLayerBorders);
+ std::vector<base::StringPiece> entries = base::SplitStringPiece(
+ layer_borders_string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ if (entries.empty()) {
+ settings.initial_debug_state.show_debug_borders.set();
+ } else {
+ for (const auto& entry : entries) {
+ const struct {
+ const char* name;
+ cc::DebugBorderType type;
+ } kBorders[] = {{cc::switches::kCompositedRenderPassBorders,
+ cc::DebugBorderType::RENDERPASS},
+ {cc::switches::kCompositedSurfaceBorders,
+ cc::DebugBorderType::SURFACE},
+ {cc::switches::kCompositedLayerBorders,
+ cc::DebugBorderType::LAYER}};
+ for (const auto& border : kBorders) {
+ if (border.name == entry) {
+ settings.initial_debug_state.show_debug_borders.set(border.type);
+ break;
+ }
+ }
+ }
+ }
+ }
settings.initial_debug_state.show_fps_counter =
command_line->HasSwitch(cc::switches::kUIShowFPSCounter);
settings.initial_debug_state.show_layer_animation_bounds_rects =
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698