Migrate base::TaskRunner from Closure to OnceClosure
Migrate base::TaskRunner from Closure to OnceClosure https://codereview.chromium.org/2637843002 Pass Callback to TaskRunner by value and consume it on invocation (1) https://codereview.chromium.org/2726523002 Replace base::get with std::get https://codereview.chromium.org/2797133002
This commit is contained in:
parent
ffbb16e854
commit
d09cab2e21
4 changed files with 20 additions and 17 deletions
|
@ -13,17 +13,17 @@ void BridgeTaskRunner::MessageLoopIsReady() {
|
|||
CHECK(message_loop);
|
||||
for (const TaskPair& task : tasks_) {
|
||||
message_loop->task_runner()->PostDelayedTask(
|
||||
base::get<0>(task), base::get<1>(task), base::get<2>(task));
|
||||
std::get<0>(task), std::get<1>(task), std::get<2>(task));
|
||||
}
|
||||
for (const TaskPair& task : non_nestable_tasks_) {
|
||||
message_loop->task_runner()->PostNonNestableDelayedTask(
|
||||
base::get<0>(task), base::get<1>(task), base::get<2>(task));
|
||||
std::get<0>(task), std::get<1>(task), std::get<2>(task));
|
||||
}
|
||||
}
|
||||
|
||||
bool BridgeTaskRunner::PostDelayedTask(
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& task,
|
||||
base::OnceClosure task,
|
||||
base::TimeDelta delay) {
|
||||
auto message_loop = base::MessageLoop::current();
|
||||
if (!message_loop) {
|
||||
|
@ -31,7 +31,8 @@ bool BridgeTaskRunner::PostDelayedTask(
|
|||
return true;
|
||||
}
|
||||
|
||||
return message_loop->task_runner()->PostDelayedTask(from_here, task, delay);
|
||||
return message_loop->task_runner()->PostDelayedTask(
|
||||
from_here, std::move(task), delay);
|
||||
}
|
||||
|
||||
bool BridgeTaskRunner::RunsTasksOnCurrentThread() const {
|
||||
|
@ -44,7 +45,7 @@ bool BridgeTaskRunner::RunsTasksOnCurrentThread() const {
|
|||
|
||||
bool BridgeTaskRunner::PostNonNestableDelayedTask(
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& task,
|
||||
base::OnceClosure task,
|
||||
base::TimeDelta delay) {
|
||||
auto message_loop = base::MessageLoop::current();
|
||||
if (!message_loop) {
|
||||
|
@ -53,7 +54,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
|
|||
}
|
||||
|
||||
return message_loop->task_runner()->PostNonNestableDelayedTask(
|
||||
from_here, task, delay);
|
||||
from_here, std::move(task), delay);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue