Skip to content

Commit

Permalink
Fix some lint/style error am: 1d99ae1 am: d9ff838
Browse files Browse the repository at this point in the history
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/1706025

Change-Id: I76acacf4ab3ab9c6645e4e02c6c13dd864d91591
  • Loading branch information
zhangxp1998 authored and android-build-merge-worker-robot committed May 13, 2021
2 parents d121fd1 + d9ff838 commit 0a3e95f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions common/scoped_task_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class ScopedTaskId {
using MessageLoop = brillo::MessageLoop;

public:
// Move only type similar to unique_ptr.
ScopedTaskId(const ScopedTaskId&) = delete;
ScopedTaskId& operator=(const ScopedTaskId&) = delete;

constexpr ScopedTaskId() = default;

constexpr ScopedTaskId(ScopedTaskId&& other) noexcept {
Expand Down Expand Up @@ -86,8 +90,6 @@ class ScopedTaskId {
}

private:
ScopedTaskId(const ScopedTaskId&) = delete;
ScopedTaskId& operator=(const ScopedTaskId&) = delete;
template <typename Callable>
[[nodiscard]] bool PostTask(const base::Location& from_here,
Callable&& callback,
Expand Down
14 changes: 7 additions & 7 deletions payload_consumer/filesystem_verifier_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace chromeos_update_engine {

namespace {
const off_t kReadFileBufferSize = 128 * 1024;
constexpr float VERITY_PROGRESS_PERCENT = 0.6;
constexpr float kVerityProgressPercent = 0.6;
} // namespace

void FilesystemVerifierAction::PerformAction() {
Expand Down Expand Up @@ -136,9 +136,9 @@ void FilesystemVerifierAction::UpdateProgress(double progress) {
}

void FilesystemVerifierAction::UpdatePartitionProgress(double progress) {
// WE don't consider sizes of each partition. Every partition
// We don't consider sizes of each partition. Every partition
// has the same length on progress bar.
// TODO(zhangkelvin) Take sizes of each partition into account
// TODO(b/186087589): Take sizes of each partition into account.
UpdateProgress((progress + partition_index_) /
install_plan_.partitions.size());
}
Expand Down Expand Up @@ -213,7 +213,7 @@ void FilesystemVerifierAction::WriteVerityAndHashPartition(
return;
}
if (dynamic_control_->UpdateUsesSnapshotCompression()) {
// spin up snapuserd to read fs
// Spin up snapuserd to read fs.
if (!InitializeFdVABC(false)) {
LOG(ERROR) << "Failed to map all partitions";
Cleanup(ErrorCode::kFilesystemVerifierError);
Expand Down Expand Up @@ -245,7 +245,7 @@ void FilesystemVerifierAction::WriteVerityAndHashPartition(
return;
}
UpdatePartitionProgress((start_offset + bytes_read) * 1.0f / partition_size_ *
VERITY_PROGRESS_PERCENT);
kVerityProgressPercent);
CHECK(pending_task_id_.PostTask(
FROM_HERE,
base::BindOnce(&FilesystemVerifierAction::WriteVerityAndHashPartition,
Expand Down Expand Up @@ -290,8 +290,8 @@ void FilesystemVerifierAction::HashPartition(FileDescriptorPtr fd,
return;
}
const auto progress = (start_offset + bytes_read) * 1.0f / partition_size_;
UpdatePartitionProgress(progress * (1 - VERITY_PROGRESS_PERCENT) +
VERITY_PROGRESS_PERCENT);
UpdatePartitionProgress(progress * (1 - kVerityProgressPercent) +
kVerityProgressPercent);
CHECK(pending_task_id_.PostTask(
FROM_HERE,
base::BindOnce(&FilesystemVerifierAction::HashPartition,
Expand Down

0 comments on commit 0a3e95f

Please sign in to comment.