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

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

Issue 1033493002: Histogram for UMA log upload connection type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Histogram type changed, refactoring network_metrics_provider_ + nits Created 5 years, 9 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 // Store the updated list to disk now that the removed log is uploaded. 990 // Store the updated list to disk now that the removed log is uploaded.
991 log_manager_.PersistUnsentLogs(); 991 log_manager_.PersistUnsentLogs();
992 } 992 }
993 993
994 // Error 400 indicates a problem with the log, not with the server, so 994 // Error 400 indicates a problem with the log, not with the server, so
995 // don't consider that a sign that the server is in trouble. 995 // don't consider that a sign that the server is in trouble.
996 bool server_is_healthy = upload_succeeded || response_code == 400; 996 bool server_is_healthy = upload_succeeded || response_code == 400;
997 scheduler_->UploadFinished(server_is_healthy, log_manager_.has_unsent_logs()); 997 scheduler_->UploadFinished(server_is_healthy, log_manager_.has_unsent_logs());
998 998
999 if (server_is_healthy) 999 if (server_is_healthy)
1000 client_->OnLogUploadComplete(); 1000 client_->OnLogUploadComplete(upload_succeeded);
Ilya Sherman 2015/03/24 21:55:44 I think we might be able to significantly reduce t
gayane -on leave until 09-2017 2015/03/25 21:02:33 I like this. Done.
1001 } 1001 }
1002 1002
1003 void MetricsService::IncrementPrefValue(const char* path) { 1003 void MetricsService::IncrementPrefValue(const char* path) {
1004 int value = local_state_->GetInteger(path); 1004 int value = local_state_->GetInteger(path);
1005 local_state_->SetInteger(path, value + 1); 1005 local_state_->SetInteger(path, value + 1);
1006 } 1006 }
1007 1007
1008 void MetricsService::IncrementLongPrefsValue(const char* path) { 1008 void MetricsService::IncrementLongPrefsValue(const char* path) {
1009 int64 value = local_state_->GetInt64(path); 1009 int64 value = local_state_->GetInt64(path);
1010 local_state_->SetInt64(path, value + 1); 1010 local_state_->SetInt64(path, value + 1);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 local_state_->SetBoolean(path, value); 1129 local_state_->SetBoolean(path, value);
1130 RecordCurrentState(local_state_); 1130 RecordCurrentState(local_state_);
1131 } 1131 }
1132 1132
1133 void MetricsService::RecordCurrentState(PrefService* pref) { 1133 void MetricsService::RecordCurrentState(PrefService* pref) {
1134 pref->SetInt64(prefs::kStabilityLastTimestampSec, 1134 pref->SetInt64(prefs::kStabilityLastTimestampSec,
1135 base::Time::Now().ToTimeT()); 1135 base::Time::Now().ToTimeT());
1136 } 1136 }
1137 1137
1138 } // namespace metrics 1138 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698