Skip to content

Commit

Permalink
Fix use-after-move in //base/test/
Browse files Browse the repository at this point in the history
Fix use-after-move (potential) bugs found by the
"bugprone-use-after-move" clang-tidy check.

Bug: 1122844
Change-Id: I9515efae60d93ede65aa3b8de11f6ee05828e109
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2382812
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802930}
  • Loading branch information
Maksim Ivanov authored and Commit Bot committed Aug 29, 2020
1 parent 4798ea2 commit 6d9ba7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/test/task_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,15 @@ void TaskEnvironment::TestTaskTracker::RunTask(internal::Task task,
// watching for tests that have actually long running tasks which cause our
// test suites to run slowly.
base::TimeTicks before = base::subtle::TimeTicksNowIgnoringOverride();
const Location posted_from = task.posted_from;
internal::ThreadPoolImpl::TaskTrackerImpl::RunTask(std::move(task),
sequence, traits);
base::TimeTicks after = base::subtle::TimeTicksNowIgnoringOverride();

if ((after - before) > TestTimeouts::action_max_timeout()) {
ADD_FAILURE() << "TaskEnvironment: RunTask took more than "
<< TestTimeouts::action_max_timeout().InSeconds()
<< " seconds. "
<< "Posted from " << task.posted_from.ToString();
<< " seconds. Posted from " << posted_from.ToString();
}
}

Expand Down

0 comments on commit 6d9ba7c

Please sign in to comment.