Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: device/bluetooth/test/bluetooth_test_win.cc

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/test_blink_web_unit_test_support.cc ('k') | docs/callback.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/bluetooth_test_win.cc
diff --git a/device/bluetooth/test/bluetooth_test_win.cc b/device/bluetooth/test/bluetooth_test_win.cc
index 46c39cd09b3a839dc3df1929f4e14b7b0205e8ed..00fd63569aa91b4207e34a0c7983e370e4ece1d2 100644
--- a/device/bluetooth/test/bluetooth_test_win.cc
+++ b/device/bluetooth/test/bluetooth_test_win.cc
@@ -472,14 +472,13 @@ win::GattCharacteristic* BluetoothTestWin::GetSimulatedCharacteristic(
void BluetoothTestWin::RunPendingTasksUntilCallback() {
std::deque<base::TestPendingTask> tasks =
- bluetooth_task_runner_->GetPendingTasks();
- bluetooth_task_runner_->ClearPendingTasks();
+ bluetooth_task_runner_->TakePendingTasks();
int original_callback_count = callback_count_;
int original_error_callback_count = error_callback_count_;
do {
- base::TestPendingTask task = tasks.front();
+ base::TestPendingTask task = std::move(tasks.front());
tasks.pop_front();
- task.task.Run();
+ std::move(task.task).Run();
base::RunLoop().RunUntilIdle();
} while (tasks.size() && callback_count_ == original_callback_count &&
error_callback_count_ == original_error_callback_count);
@@ -487,10 +486,10 @@ void BluetoothTestWin::RunPendingTasksUntilCallback() {
// Put the rest of pending tasks back to Bluetooth task runner.
for (const auto& task : tasks) {
if (task.delay.is_zero()) {
- bluetooth_task_runner_->PostTask(task.location, task.task);
+ bluetooth_task_runner_->PostTask(task.location, std::move(task.task));
} else {
- bluetooth_task_runner_->PostDelayedTask(task.location, task.task,
- task.delay);
+ bluetooth_task_runner_->PostDelayedTask(task.location,
+ std::move(task.task), task.delay);
}
}
}
« no previous file with comments | « content/test/test_blink_web_unit_test_support.cc ('k') | docs/callback.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698