Chromium Code Reviews| Index: chrome/browser/metrics/chrome_metrics_service_client.cc |
| diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc |
| index 2153ae594546321287b7d33a706dce169e850b76..93207c8744d33a80c59c719f1a000c0a8dcfb6a5 100644 |
| --- a/chrome/browser/metrics/chrome_metrics_service_client.cc |
| +++ b/chrome/browser/metrics/chrome_metrics_service_client.cc |
| @@ -45,6 +45,7 @@ |
| #include "chrome/common/features.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/installer/util/util_constants.h" |
| +#include "components/browser_watcher/features.h" |
| #include "components/metrics/call_stack_profile_metrics_provider.h" |
| #include "components/metrics/drive_metrics_provider.h" |
| #include "components/metrics/file_metrics_provider.h" |
| @@ -105,6 +106,7 @@ |
| #include "chrome/common/metrics_constants_util_win.h" |
| #include "chrome/install_static/install_util.h" |
| #include "chrome/installer/util/browser_distribution.h" |
| +#include "components/browser_watcher/stability_debugging_win.h" |
| #include "components/browser_watcher/watcher_metrics_provider_win.h" |
| #endif |
| @@ -257,6 +259,17 @@ void GetExecutableVersionDetails(base::string16* product_name, |
| exe_file, product_name, version_number, &unused_special_build, |
| channel_name); |
| } |
| + |
| +bool GetStabilityFilePath(base::FilePath* path) { |
| + DCHECK_NE(path, nullptr); |
|
bcwhite
2016/11/22 20:32:15
Put the expected value first. But for pointers yo
manzagop (departed)
2016/11/22 21:06:37
Kept the _NE version because I prefer the more ver
|
| + |
| + base::FilePath user_data_dir; |
| + if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) |
| + return false; |
| + |
| + return browser_watcher::GetStabilityFileForProcess(base::Process::Current(), |
| + user_data_dir, path); |
| +} |
| #endif // OS_WIN |
| } // namespace |
| @@ -394,6 +407,28 @@ void ChromeMetricsServiceClient::OnLogUploadComplete() { |
| #endif |
| } |
| +void ChromeMetricsServiceClient::OnLogCleanShutdown() { |
| +#if defined(OS_WIN) |
| + if (!base::FeatureList::IsEnabled( |
| + browser_watcher::kStabilityDebuggingFeature)) { |
| + return; |
| + } |
| + |
| + base::FilePath stability_file; |
| + if (!GetStabilityFilePath(&stability_file)) { |
| + // TODO(manzagop): add a metric for this. |
| + return; |
| + } |
| + |
| + // Open (with delete) and then immediately close the file by going out of |
| + // scope. This should cause the stability debugging file to be deleted prior |
| + // to the next execution. |
| + base::File file(stability_file, base::File::FLAG_OPEN | |
| + base::File::FLAG_READ | |
| + base::File::FLAG_DELETE_ON_CLOSE); |
| +#endif // OS_WIN |
| +} |
| + |
| void ChromeMetricsServiceClient::InitializeSystemProfileMetrics( |
| const base::Closure& done_callback) { |
| DCHECK(initialize_task_queue_.empty()); |