Skip to content

Commit

Permalink
PinManager: Only handle events when in the right stages
Browse files Browse the repository at this point in the history
Bug: b:269038633
Test: chromeos_unittests --gtest_filter=DriveFsPinManagerTest.*
Change-Id: I09999d8030a3efa223027891da8d45443c96b8f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4243038
Reviewed-by: Marcello Salomao <msalomao@google.com>
Commit-Queue: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1104357}
  • Loading branch information
fdegros authored and Chromium LUCI CQ committed Feb 13, 2023
1 parent 876e6f0 commit 0d841ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions chromeos/ash/components/drivefs/drivefs_pin_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,12 @@ void PinManager::OnSyncingStatusUpdate(const mojom::SyncingStatus& status) {

for (const mojom::ItemEventPtr& event : status.item_events) {
DCHECK(event);

if (!InProgress(progress_.stage)) {
VLOG(2) << "Ignored " << Quote(*event);
continue;
}

if (OnSyncingEvent(*event)) {
progress_.useful_events++;
} else {
Expand Down Expand Up @@ -881,6 +887,12 @@ void PinManager::OnFilesChanged(const std::vector<mojom::FileChange>& changes) {
void PinManager::OnFileCreated(const mojom::FileChange& event) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

if (!InProgress(progress_.stage)) {
VLOG(2) << "Ignored " << Quote(event) << ": PinManager is currently "
<< progress_.stage;
return;
}

const Id id = Id(event.stable_id);
const Path& path = event.path;

Expand Down

0 comments on commit 0d841ba

Please sign in to comment.