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

Side by Side 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: Started the profiling in AttemptUserExit instead of BrowserMainRunner::Shutdown. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/lifetime/application_lifetime.h" 5 #include "chrome/browser/lifetime/application_lifetime.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #if defined(OS_CHROMEOS) 117 #if defined(OS_CHROMEOS)
118 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker( 118 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker(
119 "StartedClosingWindows", false); 119 "StartedClosingWindows", false);
120 #endif 120 #endif
121 scoped_refptr<BrowserCloseManager> browser_close_manager = 121 scoped_refptr<BrowserCloseManager> browser_close_manager =
122 new BrowserCloseManager; 122 new BrowserCloseManager;
123 browser_close_manager->StartClosingBrowsers(); 123 browser_close_manager->StartClosingBrowsers();
124 } 124 }
125 125
126 void AttemptUserExit() { 126 void AttemptUserExit() {
127 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
128 if (command_line.HasSwitch(switches::kTraceShutdown)) {
129 base::debug::CategoryFilter category_filter(
130 command_line.GetSwitchValueASCII(switches::kTraceShutdown));
131 base::debug::TraceLog::GetInstance()->SetEnabled(
132 category_filter,
133 base::debug::TraceLog::RECORD_UNTIL_FULL);
DaveMoore 2013/08/30 22:51:15 Be sure to turn off tracing if the attempt to exit
Mr4D (OOO till 08-26) 2013/08/31 02:03:44 Good one. I haven't figured out yet how it can fai
134 }
135 TRACE_EVENT0("shutdown", "AttemptUserExit");
DaveMoore 2013/08/30 22:51:15 It sure would be good to get system tracing on Chr
Mr4D (OOO till 08-26) 2013/08/31 02:03:44 We can add "system events" also - in a later CL as
136
127 #if defined(OS_CHROMEOS) 137 #if defined(OS_CHROMEOS)
128 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); 138 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
129 // Write /tmp/uptime-logout-started as well. 139 // Write /tmp/uptime-logout-started as well.
130 const char kLogoutStarted[] = "logout-started"; 140 const char kLogoutStarted[] = "logout-started";
131 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); 141 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted);
132 142
133 // Login screen should show up in owner's locale. 143 // Login screen should show up in owner's locale.
134 PrefService* state = g_browser_process->local_state(); 144 PrefService* state = g_browser_process->local_state();
135 if (state) { 145 if (state) {
136 std::string owner_locale = state->GetString(prefs::kOwnerLocale); 146 std::string owner_locale = state->GetString(prefs::kOwnerLocale);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // environment is still active. 374 // environment is still active.
365 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) 375 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE)
366 return !ash::Shell::HasInstance(); 376 return !ash::Shell::HasInstance();
367 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) 377 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
368 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); 378 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty();
369 #endif 379 #endif
370 return true; 380 return true;
371 } 381 }
372 382
373 } // namespace chrome 383 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698