Chromium Code Reviews| Index: ui/compositor/compositor.cc |
| diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc |
| index b83b08feeae9720452a7df762f0b8dbd7b040c03..c73d911bbe18dc2b91c0808a9276373886729b49 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<std::string> entries = base::SplitString( |
|
danakj
2017/04/13 22:35:42
base::SplitStringPiece is lighter, doesn't require
reveman
2017/04/13 23:32:47
Done.
|
| + 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 = |