diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 18:38:08 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 18:38:08 +0000 |
commit | 8b257c9762e9051c1d4e794900d1084fd81913cd (patch) | |
tree | 36a68a41347aed8661b800c524d336a921bf7972 /ash/debug.cc | |
parent | 65a3cd78252f3a1edae4ae595820e0cb2cd0ba9d (diff) | |
download | chromium_src-8b257c9762e9051c1d4e794900d1084fd81913cd.zip chromium_src-8b257c9762e9051c1d4e794900d1084fd81913cd.tar.gz chromium_src-8b257c9762e9051c1d4e794900d1084fd81913cd.tar.bz2 |
Add debug shortcuts that toggles options to shows paint rects, debug borders and fps counters.
Cleanup: Separate desktop shortcuts which are useful only on linux desktop, and debug shortcuts.
BUG=227375
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=195733
Review URL: https://chromiumcodereview.appspot.com/14050009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/debug.cc')
-rw-r--r-- | ash/debug.cc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ash/debug.cc b/ash/debug.cc new file mode 100644 index 0000000..060627c --- /dev/null +++ b/ash/debug.cc @@ -0,0 +1,61 @@ +// Copyright (c) 2013 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 "ash/debug.h" + +#include "ash/shell.h" +#include "cc/debug/layer_tree_debug_state.h" +#include "ui/aura/root_window.h" +#include "ui/compositor/compositor.h" + +namespace ash { +namespace debug { + +void ToggleShowDebugBorders() { + Shell::RootWindowList root_windows = + Shell::GetInstance()->GetAllRootWindows(); + scoped_ptr<bool> value; + for (Shell::RootWindowList::iterator it = root_windows.begin(); + it != root_windows.end(); ++it) { + ui::Compositor* compositor = (*it)->compositor(); + cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); + if (!value.get()) + value.reset(new bool(!state.show_debug_borders)); + state.show_debug_borders = *value.get(); + compositor->SetLayerTreeDebugState(state); + } +} + +void ToggleShowFpsCounter() { + Shell::RootWindowList root_windows = + Shell::GetInstance()->GetAllRootWindows(); + scoped_ptr<bool> value; + for (Shell::RootWindowList::iterator it = root_windows.begin(); + it != root_windows.end(); ++it) { + ui::Compositor* compositor = (*it)->compositor(); + cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); + if (!value.get()) + value.reset(new bool(!state.show_fps_counter)); + state.show_fps_counter = *value.get(); + compositor->SetLayerTreeDebugState(state); + } +} + +void ToggleShowPaintRects() { + Shell::RootWindowList root_windows = + Shell::GetInstance()->GetAllRootWindows(); + scoped_ptr<bool> value; + for (Shell::RootWindowList::iterator it = root_windows.begin(); + it != root_windows.end(); ++it) { + ui::Compositor* compositor = (*it)->compositor(); + cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); + if (!value.get()) + value.reset(new bool(!state.show_paint_rects)); + state.show_paint_rects = *value.get(); + compositor->SetLayerTreeDebugState(state); + } +} + +} // debug +} // ash |