mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
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:
@@ -11,13 +11,13 @@ namespace atom {
|
||||
void BridgeTaskRunner::MessageLoopIsReady() {
|
||||
auto message_loop = base::MessageLoop::current();
|
||||
CHECK(message_loop);
|
||||
for (const TaskPair& task : tasks_) {
|
||||
for (TaskPair& task : tasks_) {
|
||||
message_loop->task_runner()->PostDelayedTask(
|
||||
std::get<0>(task), std::get<1>(task), std::get<2>(task));
|
||||
std::get<0>(task), std::move(std::get<1>(task)), std::get<2>(task));
|
||||
}
|
||||
for (const TaskPair& task : non_nestable_tasks_) {
|
||||
for (TaskPair& task : non_nestable_tasks_) {
|
||||
message_loop->task_runner()->PostNonNestableDelayedTask(
|
||||
std::get<0>(task), std::get<1>(task), std::get<2>(task));
|
||||
std::get<0>(task), std::move(std::get<1>(task)), std::get<2>(task));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ bool BridgeTaskRunner::PostDelayedTask(
|
||||
base::TimeDelta delay) {
|
||||
auto message_loop = base::MessageLoop::current();
|
||||
if (!message_loop) {
|
||||
tasks_.push_back(std::make_tuple(from_here, task, delay));
|
||||
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
|
||||
base::TimeDelta delay) {
|
||||
auto message_loop = base::MessageLoop::current();
|
||||
if (!message_loop) {
|
||||
non_nestable_tasks_.push_back(std::make_tuple(from_here, task, delay));
|
||||
non_nestable_tasks_.push_back(std::make_tuple(
|
||||
from_here, std::move(task), delay));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user