Commit 6d9ba7c8 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Fix use-after-move in //base/test/

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/+/2382812Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802930}
parent 4798ea25
...@@ -780,6 +780,7 @@ void TaskEnvironment::TestTaskTracker::RunTask(internal::Task task, ...@@ -780,6 +780,7 @@ void TaskEnvironment::TestTaskTracker::RunTask(internal::Task task,
// watching for tests that have actually long running tasks which cause our // watching for tests that have actually long running tasks which cause our
// test suites to run slowly. // test suites to run slowly.
base::TimeTicks before = base::subtle::TimeTicksNowIgnoringOverride(); base::TimeTicks before = base::subtle::TimeTicksNowIgnoringOverride();
const Location posted_from = task.posted_from;
internal::ThreadPoolImpl::TaskTrackerImpl::RunTask(std::move(task), internal::ThreadPoolImpl::TaskTrackerImpl::RunTask(std::move(task),
sequence, traits); sequence, traits);
base::TimeTicks after = base::subtle::TimeTicksNowIgnoringOverride(); base::TimeTicks after = base::subtle::TimeTicksNowIgnoringOverride();
...@@ -787,8 +788,7 @@ void TaskEnvironment::TestTaskTracker::RunTask(internal::Task task, ...@@ -787,8 +788,7 @@ void TaskEnvironment::TestTaskTracker::RunTask(internal::Task task,
if ((after - before) > TestTimeouts::action_max_timeout()) { if ((after - before) > TestTimeouts::action_max_timeout()) {
ADD_FAILURE() << "TaskEnvironment: RunTask took more than " ADD_FAILURE() << "TaskEnvironment: RunTask took more than "
<< TestTimeouts::action_max_timeout().InSeconds() << TestTimeouts::action_max_timeout().InSeconds()
<< " seconds. " << " seconds. Posted from " << posted_from.ToString();
<< "Posted from " << task.posted_from.ToString();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment