| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/debug.h" | 5 #include "ash/debug.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "cc/debug/layer_tree_debug_state.h" | 8 #include "cc/debug/layer_tree_debug_state.h" |
| 9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
| 10 #include "ui/compositor/compositor.h" | 10 #include "ui/compositor/compositor.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 namespace debug { | 13 namespace debug { |
| 14 | 14 |
| 15 void ToggleShowDebugBorders() { | 15 void ToggleShowDebugBorders() { |
| 16 aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); | 16 aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); |
| 17 std::unique_ptr<bool> value; | 17 std::unique_ptr<cc::DebugBorderTypes> value; |
| 18 for (aura::Window::Windows::iterator it = root_windows.begin(); | 18 for (aura::Window::Windows::iterator it = root_windows.begin(); |
| 19 it != root_windows.end(); ++it) { | 19 it != root_windows.end(); ++it) { |
| 20 ui::Compositor* compositor = (*it)->GetHost()->compositor(); | 20 ui::Compositor* compositor = (*it)->GetHost()->compositor(); |
| 21 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); | 21 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); |
| 22 if (!value.get()) | 22 if (!value.get()) |
| 23 value.reset(new bool(!state.show_debug_borders)); | 23 value.reset(new cc::DebugBorderTypes(state.show_debug_borders.flip())); |
| 24 state.show_debug_borders = *value.get(); | 24 state.show_debug_borders = *value.get(); |
| 25 compositor->SetLayerTreeDebugState(state); | 25 compositor->SetLayerTreeDebugState(state); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 void ToggleShowFpsCounter() { | 29 void ToggleShowFpsCounter() { |
| 30 aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); | 30 aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); |
| 31 std::unique_ptr<bool> value; | 31 std::unique_ptr<bool> value; |
| 32 for (aura::Window::Windows::iterator it = root_windows.begin(); | 32 for (aura::Window::Windows::iterator it = root_windows.begin(); |
| 33 it != root_windows.end(); ++it) { | 33 it != root_windows.end(); ++it) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); | 49 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); |
| 50 if (!value.get()) | 50 if (!value.get()) |
| 51 value.reset(new bool(!state.show_paint_rects)); | 51 value.reset(new bool(!state.show_paint_rects)); |
| 52 state.show_paint_rects = *value.get(); | 52 state.show_paint_rects = *value.get(); |
| 53 compositor->SetLayerTreeDebugState(state); | 53 compositor->SetLayerTreeDebugState(state); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace debug | 57 } // namespace debug |
| 58 } // namespace ash | 58 } // namespace ash |
| OLD | NEW |