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

Unified Diff: ios/web/web_thread_impl.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 | « ios/web/web_thread_impl.h ('k') | media/base/fake_single_thread_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_thread_impl.cc
diff --git a/ios/web/web_thread_impl.cc b/ios/web/web_thread_impl.cc
index 1cfa9a7d3b7f34eb0a82ba549b1aaf67ef7913c2..4ebbaac48ffbb8772d28619a8219f75fae65ec76 100644
--- a/ios/web/web_thread_impl.cc
+++ b/ios/web/web_thread_impl.cc
@@ -48,15 +48,16 @@ class WebThreadTaskRunner : public base::SingleThreadTaskRunner {
// SingleThreadTaskRunner implementation.
bool PostDelayedTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) override {
- return WebThread::PostDelayedTask(id_, from_here, task, delay);
+ return WebThread::PostDelayedTask(id_, from_here, std::move(task), delay);
}
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) override {
- return WebThread::PostNonNestableDelayedTask(id_, from_here, task, delay);
+ return WebThread::PostNonNestableDelayedTask(id_, from_here,
+ std::move(task), delay);
}
bool RunsTasksOnCurrentThread() const override {
@@ -289,7 +290,7 @@ WebThreadImpl::~WebThreadImpl() {
// static
bool WebThreadImpl::PostTaskHelper(WebThread::ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay,
bool nestable) {
DCHECK(identifier >= 0 && identifier < ID_COUNT);
@@ -313,10 +314,11 @@ bool WebThreadImpl::PostTaskHelper(WebThread::ID identifier,
: nullptr;
if (message_loop) {
if (nestable) {
- message_loop->task_runner()->PostDelayedTask(from_here, task, delay);
+ message_loop->task_runner()->PostDelayedTask(from_here, std::move(task),
+ delay);
} else {
- message_loop->task_runner()->PostNonNestableDelayedTask(from_here, task,
- delay);
+ message_loop->task_runner()->PostNonNestableDelayedTask(
+ from_here, std::move(task), delay);
}
}
@@ -328,26 +330,27 @@ bool WebThreadImpl::PostTaskHelper(WebThread::ID identifier,
// static
bool WebThread::PostBlockingPoolTask(const tracked_objects::Location& from_here,
- const base::Closure& task) {
- return g_globals.Get().blocking_pool->PostWorkerTask(from_here, task);
+ base::OnceClosure task) {
+ return g_globals.Get().blocking_pool->PostWorkerTask(from_here,
+ std::move(task));
}
// static
bool WebThread::PostBlockingPoolTaskAndReply(
const tracked_objects::Location& from_here,
- const base::Closure& task,
- const base::Closure& reply) {
- return g_globals.Get().blocking_pool->PostTaskAndReply(from_here, task,
- reply);
+ base::OnceClosure task,
+ base::OnceClosure reply) {
+ return g_globals.Get().blocking_pool->PostTaskAndReply(
+ from_here, std::move(task), std::move(reply));
}
// static
bool WebThread::PostBlockingPoolSequencedTask(
const std::string& sequence_token_name,
const tracked_objects::Location& from_here,
- const base::Closure& task) {
+ base::OnceClosure task) {
return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask(
- sequence_token_name, from_here, task);
+ sequence_token_name, from_here, std::move(task));
}
// static
@@ -410,25 +413,25 @@ bool WebThread::IsMessageLoopValid(ID identifier) {
// static
bool WebThread::PostTask(ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task) {
- return WebThreadImpl::PostTaskHelper(identifier, from_here, task,
+ base::OnceClosure task) {
+ return WebThreadImpl::PostTaskHelper(identifier, from_here, std::move(task),
base::TimeDelta(), true);
}
// static
bool WebThread::PostDelayedTask(ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) {
- return WebThreadImpl::PostTaskHelper(identifier, from_here, task, delay,
- true);
+ return WebThreadImpl::PostTaskHelper(identifier, from_here, std::move(task),
+ delay, true);
}
// static
bool WebThread::PostNonNestableTask(ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task) {
- return WebThreadImpl::PostTaskHelper(identifier, from_here, task,
+ base::OnceClosure task) {
+ return WebThreadImpl::PostTaskHelper(identifier, from_here, std::move(task),
base::TimeDelta(), false);
}
@@ -436,19 +439,19 @@ bool WebThread::PostNonNestableTask(ID identifier,
bool WebThread::PostNonNestableDelayedTask(
ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) {
- return WebThreadImpl::PostTaskHelper(identifier, from_here, task, delay,
- false);
+ return WebThreadImpl::PostTaskHelper(identifier, from_here, std::move(task),
+ delay, false);
}
// static
bool WebThread::PostTaskAndReply(ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
- const base::Closure& reply) {
+ base::OnceClosure task,
+ base::OnceClosure reply) {
return GetTaskRunnerForThread(identifier)
- ->PostTaskAndReply(from_here, task, reply);
+ ->PostTaskAndReply(from_here, std::move(task), std::move(reply));
}
// static
« no previous file with comments | « ios/web/web_thread_impl.h ('k') | media/base/fake_single_thread_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698