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

Side by Side Diff: ash/debug.cc

Issue 14386024: Add debug shortcuts that toggles options to shows debug borders and fps counters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/debug.h ('k') | ui/compositor/compositor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/aura/root_window.h" 9 #include "ui/aura/root_window.h"
9 #include "ui/compositor/compositor.h" 10 #include "ui/compositor/compositor.h"
10 11
11 namespace ash { 12 namespace ash {
12 namespace debug { 13 namespace debug {
13 14
15 void ToggleShowDebugBorders() {
16 Shell::RootWindowList root_windows =
17 Shell::GetInstance()->GetAllRootWindows();
18 scoped_ptr<bool> value;
19 for (Shell::RootWindowList::iterator it = root_windows.begin();
20 it != root_windows.end(); ++it) {
21 ui::Compositor* compositor = (*it)->compositor();
22 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
23 if (!value.get())
24 value.reset(new bool(!state.show_debug_borders));
25 state.show_debug_borders = *value.get();
26 compositor->SetLayerTreeDebugState(state);
27 }
28 }
29
30 void ToggleShowFpsCounter() {
31 Shell::RootWindowList root_windows =
32 Shell::GetInstance()->GetAllRootWindows();
33 scoped_ptr<bool> value;
34 for (Shell::RootWindowList::iterator it = root_windows.begin();
35 it != root_windows.end(); ++it) {
36 ui::Compositor* compositor = (*it)->compositor();
37 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
38 if (!value.get())
39 value.reset(new bool(!state.show_fps_counter));
40 state.show_fps_counter = *value.get();
41 compositor->SetLayerTreeDebugState(state);
42 }
43 }
44
14 void ToggleShowPaintRects() { 45 void ToggleShowPaintRects() {
15 Shell::RootWindowList root_windows = 46 Shell::RootWindowList root_windows =
16 Shell::GetInstance()->GetAllRootWindows(); 47 Shell::GetInstance()->GetAllRootWindows();
17 scoped_ptr<bool> value; 48 scoped_ptr<bool> value;
18 for (Shell::RootWindowList::iterator it = root_windows.begin(); 49 for (Shell::RootWindowList::iterator it = root_windows.begin();
19 it != root_windows.end(); ++it) { 50 it != root_windows.end(); ++it) {
20 ui::Compositor* compositor = (*it)->compositor(); 51 ui::Compositor* compositor = (*it)->compositor();
52 cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
21 if (!value.get()) 53 if (!value.get())
22 value.reset(new bool(!compositor->IsShowPaintRectsEnabled())); 54 value.reset(new bool(!state.show_paint_rects));
23 compositor->SetShowPaintRectsEnabled(*value.get()); 55 state.show_paint_rects = *value.get();
56 compositor->SetLayerTreeDebugState(state);
24 } 57 }
25 } 58 }
26 59
27 } // debug 60 } // debug
28 } // ash 61 } // ash
OLDNEW
« no previous file with comments | « ash/debug.h ('k') | ui/compositor/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698