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

Unified Diff: chrome/browser/lifetime/application_lifetime.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/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index ddac0049acc86145e0d090d0bf48d5395a7acfc3..ad0a78e3eb61e39ea31624f510161ff542b7aed7 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/user_manager.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_shutdown.h"
@@ -48,6 +49,7 @@
#if defined(OS_WIN)
#include "base/win/win_util.h"
+#include "components/browser_watcher/exit_funnel_win.h"
#endif
namespace chrome {
@@ -251,6 +253,12 @@ void ExitCleanly() {
#endif
void SessionEnding() {
+#if defined(OS_WIN)
+ browser_watcher::ExitFunnel funnel;
+
+ funnel.Init(kBrowserExitCodesRegistryPath, base::GetCurrentProcessHandle());
+ funnel.RecordEvent(L"SessionEnding");
+#endif
// This is a time-limited shutdown where we need to write as much to
// disk as we can as soon as we can, and where we must kill the
// process within a hang timeout to avoid user prompts.
@@ -276,6 +284,9 @@ void SessionEnding() {
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
+#if defined(OS_WIN)
+ funnel.RecordEvent(L"EndSession");
+#endif
// Write important data first.
g_browser_process->EndSession();
@@ -283,6 +294,12 @@ void SessionEnding() {
base::win::SetShouldCrashOnProcessDetach(false);
#endif
+#if defined(OS_WIN)
+ // KillProcess ought to terminate the process without further ado, so if
+ // execution gets to this point, presumably this is normal exit.
+ funnel.RecordEvent(L"KillProcess");
+#endif
+
// On Windows 7 and later, the system will consider the process ripe for
// termination as soon as it hides or destroys its windows. Since any
// execution past that point will be non-deterministically cut short, we

Powered by Google App Engine
This is Rietveld 408576698