summaryrefslogtreecommitdiff
path: root/chromium/base/callback_helpers.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-20 10:33:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-22 11:45:12 +0000
commitbe59a35641616a4cf23c4a13fa0632624b021c1b (patch)
tree9da183258bdf9cc413f7562079d25ace6955467f /chromium/base/callback_helpers.cc
parentd702e4b6a64574e97fc7df8fe3238cde70242080 (diff)
downloadqtwebengine-chromium-be59a35641616a4cf23c4a13fa0632624b021c1b.tar.gz
BASELINE: Update Chromium to 62.0.3202.101
Change-Id: I2d5eca8117600df6d331f6166ab24d943d9814ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/base/callback_helpers.cc')
-rw-r--r--chromium/base/callback_helpers.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/chromium/base/callback_helpers.cc b/chromium/base/callback_helpers.cc
index 838e6c8d849..1f87a6c35e6 100644
--- a/chromium/base/callback_helpers.cc
+++ b/chromium/base/callback_helpers.cc
@@ -4,18 +4,16 @@
#include "base/callback_helpers.h"
-#include "base/callback.h"
-
namespace base {
ScopedClosureRunner::ScopedClosureRunner() {}
-ScopedClosureRunner::ScopedClosureRunner(const Closure& closure)
- : closure_(closure) {}
+ScopedClosureRunner::ScopedClosureRunner(OnceClosure closure)
+ : closure_(std::move(closure)) {}
ScopedClosureRunner::~ScopedClosureRunner() {
if (!closure_.is_null())
- closure_.Run();
+ std::move(closure_).Run();
}
ScopedClosureRunner::ScopedClosureRunner(ScopedClosureRunner&& other)
@@ -28,19 +26,15 @@ ScopedClosureRunner& ScopedClosureRunner::operator=(
}
void ScopedClosureRunner::RunAndReset() {
- Closure old_closure = Release();
- if (!old_closure.is_null())
- old_closure.Run();
+ std::move(closure_).Run();
}
-void ScopedClosureRunner::ReplaceClosure(const Closure& closure) {
- closure_ = closure;
+void ScopedClosureRunner::ReplaceClosure(OnceClosure closure) {
+ closure_ = std::move(closure);
}
-Closure ScopedClosureRunner::Release() {
- Closure result = closure_;
- closure_.Reset();
- return result;
+OnceClosure ScopedClosureRunner::Release() {
+ return std::move(closure_);
}
} // namespace base