diff options
author | Alex Vakulenko <avakulenko@chromium.org> | 2014-06-16 13:19:00 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-18 01:39:59 +0000 |
commit | d2779df63aaad8b65fc5d4badee7dbc9bed7f2b6 (patch) | |
tree | e34a511ee4068d8d9cd46a992a4e147f3afbd351 /payload_state.cc | |
parent | b683327ed3f50ef89324069fc87ee076b65bee46 (diff) |
update_engine: fixed warnings from cpplint
Fixed all the cpplint warnings in update engine.
BUG=None
TEST=Unit tests still pass.
Change-Id: I285ae858eec8abe0b26ff203b99a42a200ceb71c
Reviewed-on: https://chromium-review.googlesource.com/204027
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Diffstat (limited to 'payload_state.cc')
-rw-r--r-- | payload_state.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/payload_state.cc b/payload_state.cc index 3f9aa19c..a9815464 100644 --- a/payload_state.cc +++ b/payload_state.cc @@ -5,6 +5,7 @@ #include "update_engine/payload_state.h" #include <algorithm> +#include <string> #include <base/logging.h> #include <base/strings/string_util.h> @@ -48,10 +49,9 @@ PayloadState::PayloadState() p2p_num_attempts_(0), attempt_num_bytes_downloaded_(0), attempt_connection_type_(metrics::ConnectionType::kUnknown), - attempt_type_(AttemptType::kUpdate) -{ - for (int i = 0; i <= kNumDownloadSources; i++) - total_bytes_downloaded_[i] = current_bytes_downloaded_[i] = 0; + attempt_type_(AttemptType::kUpdate) { + for (int i = 0; i <= kNumDownloadSources; i++) + total_bytes_downloaded_[i] = current_bytes_downloaded_[i] = 0; } bool PayloadState::Initialize(SystemState* system_state) { @@ -291,11 +291,12 @@ void PayloadState::UpdateFailed(ErrorCode error) { // (because download from a local server URL that appears earlier in a // response is preferable than downloading from the next URL which could be // a internet URL and thus could be more expensive). + case ErrorCode::kError: case ErrorCode::kDownloadTransferError: case ErrorCode::kDownloadWriteError: case ErrorCode::kDownloadStateInitializationError: - case ErrorCode::kOmahaErrorInHTTPResponse: // Aggregate for HTTP errors. + case ErrorCode::kOmahaErrorInHTTPResponse: // Aggregate for HTTP errors. IncrementFailureCount(); break; @@ -497,7 +498,7 @@ void PayloadState::UpdateBackoffExpiryTime() { // Since we're doing left-shift below, make sure we don't shift more // than this. E.g. if int is 4-bytes, don't left-shift more than 30 bits, // since we don't expect value of kMaxBackoffDays to be more than 100 anyway. - int num_days = 1; // the value to be shifted. + int num_days = 1; // the value to be shifted. const int kMaxShifts = (sizeof(num_days) * 8) - 2; // Normal backoff days is 2 raised to (payload_attempt_number - 1). @@ -896,14 +897,14 @@ void PayloadState::ResetPersistedState() { SetUrlIndex(0); SetUrlFailureCount(0); SetUrlSwitchCount(0); - UpdateBackoffExpiryTime(); // This will reset the backoff expiry time. + UpdateBackoffExpiryTime(); // This will reset the backoff expiry time. SetUpdateTimestampStart(system_state_->clock()->GetWallclockTime()); - SetUpdateTimestampEnd(Time()); // Set to null time + SetUpdateTimestampEnd(Time()); // Set to null time SetUpdateDurationUptime(TimeDelta::FromSeconds(0)); ResetDownloadSourcesOnNewUpdate(); ResetRollbackVersion(); SetP2PNumAttempts(0); - SetP2PFirstAttemptTimestamp(Time()); // Set to null time + SetP2PFirstAttemptTimestamp(Time()); // Set to null time } void PayloadState::ResetRollbackVersion() { @@ -1334,8 +1335,8 @@ void PayloadState::BootedIntoUpdate(TimeDelta time_to_reboot) { string metric = "Installer.TimeToRebootMinutes"; system_state_->metrics_lib()->SendToUMA(metric, time_to_reboot.InMinutes(), - 0, // min: 0 minute - 30*24*60, // max: 1 month (approx) + 0, // min: 0 minute + 30*24*60, // max: 1 month (approx) kNumDefaultUmaBuckets); LOG(INFO) << "Uploading " << utils::FormatTimeDelta(time_to_reboot) << " for metric " << metric; @@ -1343,8 +1344,8 @@ void PayloadState::BootedIntoUpdate(TimeDelta time_to_reboot) { metric = metrics::kMetricTimeToRebootMinutes; system_state_->metrics_lib()->SendToUMA(metric, time_to_reboot.InMinutes(), - 0, // min: 0 minute - 30*24*60, // max: 1 month (approx) + 0, // min: 0 minute + 30*24*60, // max: 1 month (approx) kNumDefaultUmaBuckets); LOG(INFO) << "Uploading " << utils::FormatTimeDelta(time_to_reboot) << " for metric " << metric; @@ -1392,7 +1393,7 @@ void PayloadState::ReportFailedBootIfNeeded() { LOG(ERROR) << "Error reading TargetVersionInstalledFrom on reboot."; return; } - if (int(installed_from) == + if (static_cast<int>(installed_from) == utils::GetPartitionNumber(system_state_->hardware()->BootDevice())) { // A reboot was pending, but the chromebook is again in the same // BootDevice where the update was installed from. |