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 2861db7cdd25856894100c062c4ab3cc835428f0..b7d9607b68794c06b08544bdb981df8317caf112 100644 |
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc |
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc |
@@ -182,6 +182,22 @@ CreateInstallerFileMetricsProvider(bool metrics_reporting_enabled) { |
return file_metrics_provider; |
} |
+void CleanupGlobalPersistentHistogramStorage() { |
Ilya Sherman
2016/06/17 19:54:32
nit: s/Cleanup/CleanUp
bcwhite
2016/06/20 16:21:28
Done.
|
+ // If there is a global metrics file being updated on disk, mark it to be |
+ // deleted when the process exits. A normal shutdown is almost complete |
+ // so there is no benefit in keeping a file with no new data to be processed |
+ // during the next startup sequence. |
Ilya Sherman
2016/06/17 19:54:32
To clarify: Is there any harm in keeping the file?
bcwhite
2016/06/20 16:21:28
It's very important so that startup doesn't proces
|
+ base::GlobalHistogramAllocator* allocator = |
+ base::GlobalHistogramAllocator::Get(); |
+ if (allocator) { |
+ const base::FilePath& path = allocator->GetPersistentLocation(); |
+ if (!path.empty()) { |
+ base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ | |
+ base::File::FLAG_DELETE_ON_CLOSE); |
Ilya Sherman
2016/06/17 19:54:32
nit: This seems like a somewhat indirect way to de
bcwhite
2016/06/20 16:21:28
Unfortunately no. base::DeleteFile() won't work o
|
+ } |
+ } |
+} |
+ |
} // namespace |
@@ -213,6 +229,7 @@ ChromeMetricsServiceClient::ChromeMetricsServiceClient( |
ChromeMetricsServiceClient::~ChromeMetricsServiceClient() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
+ CleanupGlobalPersistentHistogramStorage(); |
} |
// static |