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

Unified Diff: base/critical_closure.h

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: s/base::ResetAndReturn/std::move/ Created 3 years, 9 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 | « no previous file | base/critical_closure_internal_ios.mm » ('j') | chrome/browser/after_startup_task_utils.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/critical_closure.h
diff --git a/base/critical_closure.h b/base/critical_closure.h
index 1b10cde7ce60c26836573783acc2e0252940a48d..35ce2b5c46eaef880bd328eb50347eba29ebe211 100644
--- a/base/critical_closure.h
+++ b/base/critical_closure.h
@@ -5,6 +5,8 @@
#ifndef BASE_CRITICAL_CLOSURE_H_
#define BASE_CRITICAL_CLOSURE_H_
+#include <utility>
+
#include "base/callback.h"
#include "base/macros.h"
#include "build/build_config.h"
@@ -27,7 +29,7 @@ bool IsMultiTaskingSupported();
// |ios::ScopedCriticalAction|.
class CriticalClosure {
public:
- explicit CriticalClosure(const Closure& closure);
+ explicit CriticalClosure(Closure closure);
~CriticalClosure();
void Run();
@@ -55,13 +57,13 @@ class CriticalClosure {
// background running time, |MakeCriticalClosure| should be applied on them
// before posting.
#if defined(OS_IOS)
-inline Closure MakeCriticalClosure(const Closure& closure) {
+inline Closure MakeCriticalClosure(Closure closure) {
DCHECK(internal::IsMultiTaskingSupported());
return base::Bind(&internal::CriticalClosure::Run,
- Owned(new internal::CriticalClosure(closure)));
+ Owned(new internal::CriticalClosure(std::move(closure))));
}
#else // defined(OS_IOS)
-inline Closure MakeCriticalClosure(const Closure& closure) {
+inline Closure MakeCriticalClosure(Closure closure) {
// No-op for platforms where the application does not need to acquire
// background time for closures to finish when it goes into the background.
return closure;
« no previous file with comments | « no previous file | base/critical_closure_internal_ios.mm » ('j') | chrome/browser/after_startup_task_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698