| OLD | NEW |
| 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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 bool server_is_healthy = upload_succeeded || response_code == 400; | 1137 bool server_is_healthy = upload_succeeded || response_code == 400; |
| 1138 if (upload_scheduler_) { | 1138 if (upload_scheduler_) { |
| 1139 if (!log_manager_.has_unsent_logs()) { | 1139 if (!log_manager_.has_unsent_logs()) { |
| 1140 upload_scheduler_->Stop(); | 1140 upload_scheduler_->Stop(); |
| 1141 } | 1141 } |
| 1142 upload_scheduler_->UploadFinished(server_is_healthy); | 1142 upload_scheduler_->UploadFinished(server_is_healthy); |
| 1143 } else { | 1143 } else { |
| 1144 scheduler_->UploadFinished(server_is_healthy, | 1144 scheduler_->UploadFinished(server_is_healthy, |
| 1145 log_manager_.has_unsent_logs()); | 1145 log_manager_.has_unsent_logs()); |
| 1146 } | 1146 } |
| 1147 | |
| 1148 if (server_is_healthy) | |
| 1149 client_->OnLogUploadComplete(); | |
| 1150 } | 1147 } |
| 1151 | 1148 |
| 1152 void MetricsService::IncrementPrefValue(const char* path) { | 1149 void MetricsService::IncrementPrefValue(const char* path) { |
| 1153 int value = local_state_->GetInteger(path); | 1150 int value = local_state_->GetInteger(path); |
| 1154 local_state_->SetInteger(path, value + 1); | 1151 local_state_->SetInteger(path, value + 1); |
| 1155 } | 1152 } |
| 1156 | 1153 |
| 1157 void MetricsService::IncrementLongPrefsValue(const char* path) { | 1154 void MetricsService::IncrementLongPrefsValue(const char* path) { |
| 1158 int64_t value = local_state_->GetInt64(path); | 1155 int64_t value = local_state_->GetInt64(path); |
| 1159 local_state_->SetInt64(path, value + 1); | 1156 local_state_->SetInt64(path, value + 1); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, end_completed); | 1306 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, end_completed); |
| 1310 RecordCurrentState(local_state_); | 1307 RecordCurrentState(local_state_); |
| 1311 } | 1308 } |
| 1312 | 1309 |
| 1313 void MetricsService::RecordCurrentState(PrefService* pref) { | 1310 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1314 pref->SetInt64(prefs::kStabilityLastTimestampSec, | 1311 pref->SetInt64(prefs::kStabilityLastTimestampSec, |
| 1315 base::Time::Now().ToTimeT()); | 1312 base::Time::Now().ToTimeT()); |
| 1316 } | 1313 } |
| 1317 | 1314 |
| 1318 } // namespace metrics | 1315 } // namespace metrics |
| OLD | NEW |