summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/DEPS1
-rw-r--r--ash/accelerators/accelerator_controller.cc6
-rw-r--r--ash/accelerators/accelerator_table.cc4
-rw-r--r--ash/accelerators/accelerator_table.h2
-rw-r--r--ash/ash.gyp1
-rw-r--r--ash/debug.cc37
-rw-r--r--ash/debug.h2
-rw-r--r--ui/compositor/compositor.cc9
-rw-r--r--ui/compositor/compositor.h5
9 files changed, 58 insertions, 9 deletions
diff --git a/ash/DEPS b/ash/DEPS
index 7aa545b..29f9c96 100644
--- a/ash/DEPS
+++ b/ash/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+cc/debug",
"+chromeos",
"+content/public",
"+grit/ash_resources.h",
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index ac36027..19f3f3f 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -816,6 +816,12 @@ bool AcceleratorController::PerformAction(int action,
case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR:
internal::DisplayManager::ToggleDisplayScaleFactor();
return true;
+ case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
+ ash::debug::ToggleShowDebugBorders();
+ return true;
+ case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
+ ash::debug::ToggleShowFpsCounter();
+ return true;
case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
ash::debug::ToggleShowPaintRects();
return true;
diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc
index ac6f158..86c1127 100644
--- a/ash/accelerators/accelerator_table.cc
+++ b/ash/accelerators/accelerator_table.cc
@@ -206,6 +206,10 @@ const AcceleratorData kDebugAcceleratorData[] = {
PRINT_WINDOW_HIERARCHY },
{ true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
DEBUG_TOGGLE_DEVICE_SCALE_FACTOR },
+ { true, ui::VKEY_B, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
+ DEBUG_TOGGLE_SHOW_DEBUG_BORDERS },
+ { true, ui::VKEY_F, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
+ DEBUG_TOGGLE_SHOW_FPS_COUNTER },
{ true, ui::VKEY_P, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
DEBUG_TOGGLE_SHOW_PAINT_RECTS },
};
diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h
index af63dee..01fcba9 100644
--- a/ash/accelerators/accelerator_table.h
+++ b/ash/accelerators/accelerator_table.h
@@ -22,6 +22,8 @@ enum AcceleratorAction {
CYCLE_FORWARD_LINEAR,
CYCLE_FORWARD_MRU,
DEBUG_TOGGLE_DEVICE_SCALE_FACTOR,
+ DEBUG_TOGGLE_SHOW_DEBUG_BORDERS,
+ DEBUG_TOGGLE_SHOW_FPS_COUNTER,
DEBUG_TOGGLE_SHOW_PAINT_RECTS,
DISABLE_CAPS_LOCK,
EXIT,
diff --git a/ash/ash.gyp b/ash/ash.gyp
index b0c858a..feace3b 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -20,6 +20,7 @@
'../base/base.gyp:base_i18n',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
+ '../cc/cc.gyp:cc',
'../content/content.gyp:content',
'../content/content.gyp:content_browser',
'../ipc/ipc.gyp:ipc',
diff --git a/ash/debug.cc b/ash/debug.cc
index ce2ca17..060627c 100644
--- a/ash/debug.cc
+++ b/ash/debug.cc
@@ -5,12 +5,43 @@
#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();
@@ -18,9 +49,11 @@ void ToggleShowPaintRects() {
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(!compositor->IsShowPaintRectsEnabled()));
- compositor->SetShowPaintRectsEnabled(*value.get());
+ value.reset(new bool(!state.show_paint_rects));
+ state.show_paint_rects = *value.get();
+ compositor->SetLayerTreeDebugState(state);
}
}
diff --git a/ash/debug.h b/ash/debug.h
index 8ed7c7a..92838d6 100644
--- a/ash/debug.h
+++ b/ash/debug.h
@@ -12,6 +12,8 @@ namespace debug {
// Toggles debugging features controlled by
// cc::LayerTreeDebugState.
+ASH_EXPORT void ToggleShowDebugBorders();
+ASH_EXPORT void ToggleShowFpsCounter();
ASH_EXPORT void ToggleShowPaintRects();
} // debug
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 077034d..fc9b07f 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -759,13 +759,12 @@ Compositor::OffscreenContextProviderForCompositorThread() {
OffscreenContextProviderForCompositorThread();
}
-bool Compositor::IsShowPaintRectsEnabled() const {
- return host_->debug_state().show_paint_rects;
+const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const {
+ return host_->debug_state();
}
-void Compositor::SetShowPaintRectsEnabled(bool enabled) {
- cc::LayerTreeDebugState debug_state = host_->debug_state();
- debug_state.show_paint_rects = enabled;
+void Compositor::SetLayerTreeDebugState(
+ const cc::LayerTreeDebugState& debug_state) {
host_->SetDebugState(debug_state);
}
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 0d5bfc9..10c6979 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -31,6 +31,7 @@ class RunLoop;
namespace cc {
class ContextProvider;
class Layer;
+class LayerTreeDebugState;
class LayerTreeHost;
}
@@ -363,8 +364,8 @@ class COMPOSITOR_EXPORT Compositor
bool IsLocked() { return compositor_lock_ != NULL; }
- bool IsShowPaintRectsEnabled() const;
- void SetShowPaintRectsEnabled(bool enabled);
+ const cc::LayerTreeDebugState& GetLayerTreeDebugState() const;
+ void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state);
private:
friend class base::RefCounted<Compositor>;