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

Side by Side Diff: components/metrics/metrics_log.cc

Issue 2358223002: Add log date to the metrics log (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/metrics/metrics_log.h" 5 #include "components/metrics/metrics_log.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 std::string serialized_system_profile; 420 std::string serialized_system_profile;
421 std::string base64_system_profile; 421 std::string base64_system_profile;
422 if (system_profile->SerializeToString(&serialized_system_profile)) { 422 if (system_profile->SerializeToString(&serialized_system_profile)) {
423 base::Base64Encode(serialized_system_profile, &base64_system_profile); 423 base::Base64Encode(serialized_system_profile, &base64_system_profile);
424 PrefService* local_state = local_state_; 424 PrefService* local_state = local_state_;
425 local_state->SetString(prefs::kStabilitySavedSystemProfile, 425 local_state->SetString(prefs::kStabilitySavedSystemProfile,
426 base64_system_profile); 426 base64_system_profile);
427 local_state->SetString(prefs::kStabilitySavedSystemProfileHash, 427 local_state->SetString(prefs::kStabilitySavedSystemProfileHash,
428 ComputeSHA1(serialized_system_profile)); 428 ComputeSHA1(serialized_system_profile));
429 } 429 }
430
431 system_profile->set_log_date(
432 (base::Time::Now() - base::Time::UnixEpoch()).InSeconds());
430 } 433 }
431 434
432 bool MetricsLog::LoadSavedEnvironmentFromPrefs(std::string* app_version) { 435 bool MetricsLog::LoadSavedEnvironmentFromPrefs(std::string* app_version) {
433 DCHECK(app_version); 436 DCHECK(app_version);
434 app_version->clear(); 437 app_version->clear();
435 438
436 PrefService* local_state = local_state_; 439 PrefService* local_state = local_state_;
437 const std::string base64_system_profile = 440 const std::string base64_system_profile =
438 local_state->GetString(prefs::kStabilitySavedSystemProfile); 441 local_state->GetString(prefs::kStabilitySavedSystemProfile);
439 if (base64_system_profile.empty()) 442 if (base64_system_profile.empty())
(...skipping 20 matching lines...) Expand all
460 DCHECK(!closed_); 463 DCHECK(!closed_);
461 closed_ = true; 464 closed_ = true;
462 } 465 }
463 466
464 void MetricsLog::GetEncodedLog(std::string* encoded_log) { 467 void MetricsLog::GetEncodedLog(std::string* encoded_log) {
465 DCHECK(closed_); 468 DCHECK(closed_);
466 uma_proto_.SerializeToString(encoded_log); 469 uma_proto_.SerializeToString(encoded_log);
467 } 470 }
468 471
469 } // namespace metrics 472 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | components/metrics/metrics_log_unittest.cc » ('j') | components/metrics/proto/system_profile.proto » ('J')

Powered by Google App Engine
This is Rietveld 408576698