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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 23691025: Adding shutdown tracing capabilities (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 years, 3 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 | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/profiles/profile_destroyer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index 503a0740226713866267851e18ad0b8dec5db6e2..a160d7124e281501232c039225e96802f284c003 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -7,6 +7,7 @@
#include "ash/shell.h"
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -125,6 +126,7 @@ void CloseAllBrowsers() {
void AttemptUserExit() {
#if defined(OS_CHROMEOS)
+ StartShutdownTracing();
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
// Write /tmp/uptime-logout-started as well.
const char kLogoutStarted[] = "logout-started";
@@ -138,6 +140,7 @@ void AttemptUserExit() {
state->GetString(prefs::kApplicationLocale) != owner_locale &&
!state->IsManagedPreference(prefs::kApplicationLocale)) {
state->SetString(prefs::kApplicationLocale, owner_locale);
+ TRACE_EVENT0("shutdown", "CommitPendingWrite");
state->CommitPendingWrite();
}
}
@@ -154,6 +157,18 @@ void AttemptUserExit() {
#endif
}
+void StartShutdownTracing() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kTraceShutdown)) {
+ base::debug::CategoryFilter category_filter(
+ command_line.GetSwitchValueASCII(switches::kTraceShutdown));
+ base::debug::TraceLog::GetInstance()->SetEnabled(
+ category_filter,
+ base::debug::TraceLog::RECORD_UNTIL_FULL);
+ }
+ TRACE_EVENT0("shutdown", "StartShutdownTracing");
+}
+
// The Android implementation is in application_lifetime_android.cc
#if !defined(OS_ANDROID)
void AttemptRestart() {
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/profiles/profile_destroyer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698