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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 12494011: Keyboard shortcut to log views, layers, windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | ui/views/debug_utils.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 9bcf23318c5ec3949a5bd6c252948b3b756ca02c..059d702fb6dc1061013bbc70cade3017387d0f52 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -274,7 +274,6 @@ bool HandleMediaPrevTrack() {
return true;
}
-#if !defined(NDEBUG)
bool HandlePrintLayerHierarchy() {
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (size_t i = 0; i < root_windows.size(); ++i) {
@@ -290,8 +289,11 @@ bool HandlePrintViewHierarchy() {
return true;
views::Widget* browser_widget =
views::Widget::GetWidgetForNativeWindow(active_window);
- if (browser_widget)
- views::PrintViewHierarchy(browser_widget->GetRootView());
+ if (!browser_widget)
+ return true;
+ // Error so logs can be collected from end-users.
+ LOG(ERROR) << "View hierarchy:";
+ views::PrintViewHierarchy(browser_widget->GetRootView());
return true;
}
@@ -300,28 +302,37 @@ void PrintWindowHierarchy(aura::Window* window, int indent) {
std::string name(window->name());
if (name.empty())
name = "\"\"";
- DLOG(INFO) << indent_str << name << " (" << window << ")"
- << " type=" << window->type()
- << (wm::IsActiveWindow(window) ? " [active] " : " ")
- << (window->IsVisible() ? " visible " : " ")
- << window->bounds().ToString();
+ // Error so logs can be collected from end-users.
+ LOG(ERROR) << indent_str << name << " (" << window << ")"
+ << " type=" << window->type()
Daniel Erat 2013/03/16 03:32:23 nit: fix indenting on this and following lines
James Cook 2013/03/16 04:09:24 Done.
+ << (wm::IsActiveWindow(window) ? " [active] " : " ")
+ << (window->IsVisible() ? " visible " : " ")
+ << window->bounds().ToString();
for (size_t i = 0; i < window->children().size(); ++i)
PrintWindowHierarchy(window->children()[i], indent + 3);
}
bool HandlePrintWindowHierarchy() {
- DLOG(INFO) << "Window hierarchy:";
Shell::RootWindowControllerList controllers =
Shell::GetAllRootWindowControllers();
for (size_t i = 0; i < controllers.size(); ++i) {
- DLOG(INFO) << "RootWindow " << i << ":";
+ // Error so logs can be collected from end-users.
+ LOG(ERROR) << "RootWindow " << i << ":";
PrintWindowHierarchy(controllers[i]->root_window(), 0);
}
return true;
}
-#endif // !defined(NDEBUG)
+bool HandlePrintUIHierarchies() {
+ // This is a separate command so the user only has to hit one key to generate
+ // all the logs. Developers use the individual dumps repeatedly, so keep
+ // those as separate commands to avoid spamming their logs.
+ HandlePrintLayerHierarchy();
+ HandlePrintWindowHierarchy();
+ HandlePrintViewHierarchy();
+ return true;
+}
} // namespace
@@ -712,6 +723,8 @@ bool AcceleratorController::PerformAction(int action,
if (ime_control_delegate_.get())
return ime_control_delegate_->HandlePreviousIme();
break;
+ case PRINT_UI_HIERARCHIES:
+ return HandlePrintUIHierarchies();
case SWITCH_IME:
if (ime_control_delegate_.get())
return ime_control_delegate_->HandleSwitchIme(accelerator);
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | ui/views/debug_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698