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

Unified Diff: chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc

Issue 796963002: Instrument some of the exit paths likely to suffer hangs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@end_session_instrument
Patch Set: Add instrumentation for browser exit, plus now actually compiles Created 6 years 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
Index: chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
index 16dc6e592200835c4a253181a66a670c5ca46964..a2802990a93098d8a1fc4e876b0866e830eba055 100644
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
@@ -6,6 +6,7 @@
#include <dwmapi.h>
+#include "base/process/process_handle.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
@@ -16,6 +17,8 @@
#include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/theme_image_mapper.h"
+#include "chrome/common/chrome_constants.h"
+#include "components/browser_watcher/exit_funnel_win.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/win/dpi.h"
#include "ui/views/controls/menu/native_menu_win.h"
@@ -70,6 +73,31 @@ class DesktopThemeProvider : public ui::ThemeProvider {
DISALLOW_COPY_AND_ASSIGN(DesktopThemeProvider);
};
+// See http://crbug.com/412384.
+void TraceSessionEnding(LPARAM lparam) {
+ browser_watcher::ExitFunnel funnel;
+ if (!funnel.Init(chrome::kBrowserExitCodesRegistryPath,
+ base::GetCurrentProcessHandle())) {
+ return;
+ }
+
+ // This exit path is the prime suspect for most our unclean shutdowns.
+ // Trace all the possible options to WM_ENDSESSION. This may result in
+ // multiple events for a single shutdown, but that's fine.
+ funnel.RecordEvent(L"WM_ENDSESSION");
+
+ if (lparam & ENDSESSION_CLOSEAPP)
+ funnel.RecordEvent(L"ES_CloseApp");
+ if (lparam & ENDSESSION_CRITICAL)
+ funnel.RecordEvent(L"ES_Critical");
+ if (lparam & ENDSESSION_LOGOFF)
+ funnel.RecordEvent(L"ES_Logoff");
+ const LPARAM kKnownBits =
+ ENDSESSION_CLOSEAPP | ENDSESSION_CRITICAL | ENDSESSION_LOGOFF;
+ if (lparam & ~kKnownBits)
+ funnel.RecordEvent(L"ES_Other");
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -182,6 +210,7 @@ bool BrowserDesktopWindowTreeHostWin::PreHandleMSG(UINT message,
minimize_button_metrics_.OnHWNDActivated();
return false;
case WM_ENDSESSION:
+ TraceSessionEnding(l_param);
chrome::SessionEnding();
return true;
case WM_INITMENUPOPUP:

Powered by Google App Engine
This is Rietveld 408576698