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

Unified Diff: components/metrics/metrics_log.cc

Issue 2938013002: Persist core system profile during startup. (Closed)
Patch Set: added test Created 3 years, 6 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
Index: components/metrics/metrics_log.cc
diff --git a/components/metrics/metrics_log.cc b/components/metrics/metrics_log.cc
index 4d3123c41e4ba26a9403c9a13a265583a21b84f3..ba570a7315a19a25b615c29d334f96be8674c3ce 100644
--- a/components/metrics/metrics_log.cc
+++ b/components/metrics/metrics_log.cc
@@ -123,7 +123,12 @@ MetricsLog::MetricsLog(const std::string& client_id,
if (product != uma_proto_.product())
uma_proto_.set_product(product);
- RecordCoreSystemProfile(client_, uma_proto_.mutable_system_profile());
+ SystemProfileProto* system_profile = uma_proto()->mutable_system_profile();
+ RecordCoreSystemProfile(client_, system_profile);
+ if (log_type_ == ONGOING_LOG) {
+ GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile(
+ *system_profile, /*complete=*/false);
+ }
}
MetricsLog::~MetricsLog() {
@@ -338,8 +343,10 @@ std::string MetricsLog::RecordEnvironment(
std::string serialized_proto =
recorder.SerializeAndRecordEnvironmentToPrefs(*system_profile);
- GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile(
- serialized_proto);
+ if (log_type_ == ONGOING_LOG) {
+ GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile(
+ serialized_proto, /*complete=*/true);
+ }
return serialized_proto;
}
« no previous file with comments | « components/metrics/file_metrics_provider_unittest.cc ('k') | components/metrics/persistent_system_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698