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

Unified Diff: content/browser/browser_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 | « content/browser/browser_thread_impl.h ('k') | content/browser/compositor/reflector_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_thread_impl.cc
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index a3a33bdea5ecf490df43495f4cba190c0695ff41..ddc6373afab2ee755a898320f397a5076be94b7d 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -59,16 +59,17 @@ class BrowserThreadTaskRunner : 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 BrowserThread::PostDelayedTask(id_, from_here, task, delay);
+ return BrowserThread::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 BrowserThread::PostNonNestableDelayedTask(id_, from_here, task,
- delay);
+ return BrowserThread::PostNonNestableDelayedTask(id_, from_here,
+ std::move(task), delay);
}
bool RunsTasksOnCurrentThread() const override {
@@ -361,7 +362,7 @@ bool BrowserThreadImpl::StartAndWaitForTesting() {
bool BrowserThreadImpl::PostTaskHelper(
BrowserThread::ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay,
bool nestable) {
DCHECK_GE(identifier, 0);
@@ -386,10 +387,11 @@ bool BrowserThreadImpl::PostTaskHelper(
: 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);
}
}
@@ -402,35 +404,36 @@ bool BrowserThreadImpl::PostTaskHelper(
// static
bool BrowserThread::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 BrowserThread::PostBlockingPoolTaskAndReply(
const tracked_objects::Location& from_here,
- const base::Closure& task,
- const base::Closure& reply) {
+ base::OnceClosure task,
+ base::OnceClosure reply) {
return g_globals.Get().blocking_pool->PostTaskAndReply(
- from_here, task, reply);
+ from_here, std::move(task), std::move(reply));
}
// static
bool BrowserThread::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
void BrowserThread::PostAfterStartupTask(
const tracked_objects::Location& from_here,
const scoped_refptr<base::TaskRunner>& task_runner,
- const base::Closure& task) {
+ base::OnceClosure task) {
GetContentClient()->browser()->PostAfterStartupTask(from_here, task_runner,
- task);
+ std::move(task));
}
// static
@@ -489,47 +492,46 @@ bool BrowserThread::IsMessageLoopValid(ID identifier) {
// static
bool BrowserThread::PostTask(ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task) {
+ base::OnceClosure task) {
return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, base::TimeDelta(), true);
+ identifier, from_here, std::move(task), base::TimeDelta(), true);
}
// static
bool BrowserThread::PostDelayedTask(ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) {
- return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, delay, true);
+ return BrowserThreadImpl::PostTaskHelper(identifier, from_here,
+ std::move(task), delay, true);
}
// static
bool BrowserThread::PostNonNestableTask(
ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task) {
+ base::OnceClosure task) {
return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, base::TimeDelta(), false);
+ identifier, from_here, std::move(task), base::TimeDelta(), false);
}
// static
bool BrowserThread::PostNonNestableDelayedTask(
ID identifier,
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) {
- return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, delay, false);
+ return BrowserThreadImpl::PostTaskHelper(identifier, from_here,
+ std::move(task), delay, false);
}
// static
-bool BrowserThread::PostTaskAndReply(
- ID identifier,
- const tracked_objects::Location& from_here,
- const base::Closure& task,
- const base::Closure& reply) {
+bool BrowserThread::PostTaskAndReply(ID identifier,
+ const tracked_objects::Location& from_here,
+ 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 | « content/browser/browser_thread_impl.h ('k') | content/browser/compositor/reflector_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698