cc: Add --ui-foo flags for all compositor debug visualizations.

For every --show-debug-thing flag, we should have a mirrored
--ui-show-debug-thing flag to show the same information in the
UI compositor.

Move the current ui-compositor flags to cc/base/switches.h where the
renderer-compositor flags are, so that the mirrored nature is easily
seen and maintained. Also move the few renderer-compositor flags for
these compositor features to cc/base/switches.h.

The only flag that can't move is kShowPaintRects, as it is also used
for the software non-compositing path. So instead we mirror this flag
in the ui-compositor switches.

R=piman

Review URL: https://codereview.chromium.org/12909003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189062 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 954e11e..92c0a12 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -14,6 +14,7 @@
 #include "base/string_util.h"
 #include "base/threading/thread.h"
 #include "base/threading/thread_restrictions.h"
+#include "cc/base/switches.h"
 #include "cc/base/thread_impl.h"
 #include "cc/input/input_handler.h"
 #include "cc/layers/layer.h"
@@ -415,19 +416,36 @@
   root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f));
 
   CommandLine* command_line = CommandLine::ForCurrentProcess();
+
   cc::LayerTreeSettings settings;
-  settings.initialDebugState.show_fps_counter =
-      command_line->HasSwitch(switches::kUIShowFPSCounter);
-  settings.initialDebugState.show_platform_layer_tree =
-      command_line->HasSwitch(switches::kUIShowLayerTree);
   settings.refreshRate =
       g_test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate;
-  settings.initialDebugState.show_debug_borders =
-      command_line->HasSwitch(switches::kUIShowLayerBorders);
   settings.partialSwapEnabled =
-      command_line->HasSwitch(switches::kUIEnablePartialSwap);
+      command_line->HasSwitch(cc::switches::kUIEnablePartialSwap);
   settings.perTilePaintingEnabled =
-      command_line->HasSwitch(switches::kUIEnablePerTilePainting);
+      command_line->HasSwitch(cc::switches::kUIEnablePerTilePainting);
+
+  // These flags should be mirrored by renderer versions in content/renderer/.
+  settings.initialDebugState.show_debug_borders =
+      command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders);
+  settings.initialDebugState.show_fps_counter =
+      command_line->HasSwitch(cc::switches::kUIShowFPSCounter);
+  settings.initialDebugState.show_paint_rects =
+      command_line->HasSwitch(switches::kUIShowPaintRects);
+  settings.initialDebugState.show_platform_layer_tree =
+      command_line->HasSwitch(cc::switches::kUIShowCompositedLayerTree);
+  settings.initialDebugState.show_property_changed_rects =
+      command_line->HasSwitch(cc::switches::kUIShowPropertyChangedRects);
+  settings.initialDebugState.show_surface_damage_rects =
+      command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects);
+  settings.initialDebugState.show_screen_space_rects =
+      command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects);
+  settings.initialDebugState.show_replica_screen_space_rects =
+      command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects);
+  settings.initialDebugState.show_occluding_rects =
+      command_line->HasSwitch(cc::switches::kUIShowOccludingRects);
+  settings.initialDebugState.show_non_occluding_rects =
+      command_line->HasSwitch(cc::switches::kUIShowNonOccludingRects);
 
   scoped_ptr<cc::Thread> thread;
   if (g_compositor_thread) {