From 01109dcfb9dc87900f4227efe0dc81d0d382918a Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Sat, 27 Mar 2010 00:56:43 +0000 Subject: POSIX: Re-enable browser shutdown measurements. We should write the measurements to the user data directory instead of the temp directory. BUG=39098 TEST=none Review URL: http://codereview.chromium.org/1253006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42884 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_main.cc | 7 +++++-- chrome/browser/browser_main.h | 2 -- chrome/browser/browser_shutdown.cc | 12 +++++------- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 0fe528be..0fded1c 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -5,6 +5,8 @@ #include "chrome/browser/browser_main.h" #include +#include +#include #include "app/hi_res_timer_manager.h" #include "app/l10n_util.h" @@ -24,6 +26,7 @@ #include "base/time.h" #include "base/tracked_objects.h" #include "base/values.h" +#include "build/build_config.h" #include "chrome/browser/browser_main_win.h" #include "chrome/browser/browser_init.h" #include "chrome/browser/browser_list.h" @@ -239,7 +242,7 @@ class ShutdownDetector : public PlatformThread::Delegate { ShutdownDetector::ShutdownDetector(int shutdown_fd) : shutdown_fd_(shutdown_fd) { - CHECK(shutdown_fd_ != -1); + CHECK_NE(shutdown_fd_, -1); } void ShutdownDetector::ThreadMain() { @@ -867,10 +870,10 @@ int BrowserMain(const MainFunctionParams& parameters) { CreateChildThreads(browser_process.get()); -#if defined(OS_WIN) // Record last shutdown time into a histogram. browser_shutdown::ReadLastShutdownInfo(); +#if defined(OS_WIN) // On Windows, we use our startup as an opportunity to do upgrade/uninstall // tasks. Those care whether the browser is already running. On Linux/Mac, // upgrade/uninstall happen separately. diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index a9a5561..d11d4d9 100644 --- a/chrome/browser/browser_main.h +++ b/chrome/browser/browser_main.h @@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_BROWSER_MAIN_H_ #define CHROME_BROWSER_BROWSER_MAIN_H_ -#include "build/build_config.h" - struct MainFunctionParams; class MetricsService; diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index a3adf82..5d24596 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -4,6 +4,8 @@ #include "chrome/browser/browser_shutdown.h" +#include + #include "app/resource_bundle.h" #include "base/file_path.h" #include "base/file_util.h" @@ -13,6 +15,7 @@ #include "base/thread.h" #include "base/time.h" #include "base/waitable_event.h" +#include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" @@ -81,13 +84,11 @@ void OnShutdownStarting(ShutdownType type) { } } -#if defined(OS_WIN) FilePath GetShutdownMsPath() { FilePath shutdown_ms_file; - PathService::Get(base::DIR_TEMP, &shutdown_ms_file); + PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); return shutdown_ms_file.AppendASCII(kShutdownMsFile); } -#endif void Shutdown() { // Unload plugins. This needs to happen on the IO thread. @@ -146,6 +147,7 @@ void Shutdown() { shutdown_type_ != browser_shutdown::END_SESSION) { Upgrade::SwapNewChromeExeIfPresent(); } +#endif if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { // Measure total shutdown time as late in the process as possible @@ -157,13 +159,10 @@ void Shutdown() { FilePath shutdown_ms_file = GetShutdownMsPath(); file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); } -#endif UnregisterURLRequestChromeJob(); } -#if defined(OS_WIN) - void ReadLastShutdownFile( ShutdownType type, int num_procs, @@ -226,6 +225,5 @@ void ReadLastShutdownInfo() { NewRunnableFunction( &ReadLastShutdownFile, type, num_procs, num_procs_slow)); } -#endif } // namespace browser_shutdown -- cgit v1.1