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

Unified Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: erase Closure* 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 | « base/threading/worker_pool_win.cc ('k') | cc/test/ordered_simple_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager_unittest.cc
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index 3a2992b6f92d687d72d8c0902501ca041ad99389..e037fd498270b4ecb557e65eda636f6f5b3308cc 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -7,9 +7,11 @@
#include <stdint.h>
#include <memory>
+#include <utility>
#include <vector>
#include "base/bind_helpers.h"
+#include "base/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop/message_loop.h"
@@ -102,10 +104,10 @@ void OnTraceDataCollected(Closure quit_closure,
// Posts |task| to |task_runner| and blocks until it is executed.
void PostTaskAndWait(const tracked_objects::Location& from_here,
SequencedTaskRunner* task_runner,
- const base::Closure& task) {
+ base::Closure task) {
base::WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL,
WaitableEvent::InitialState::NOT_SIGNALED);
- task_runner->PostTask(from_here, task);
+ task_runner->PostTask(from_here, std::move(task));
task_runner->PostTask(
FROM_HERE, base::Bind(&WaitableEvent::Signal, base::Unretained(&event)));
// The SequencedTaskRunner guarantees that |event| will only be signaled after
@@ -181,19 +183,19 @@ class TestSequencedTaskRunner : public SequencedTaskRunner {
unsigned no_of_post_tasks() const { return num_of_post_tasks_; }
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
- const Closure& task,
+ Closure task,
TimeDelta delay) override {
NOTREACHED();
return false;
}
bool PostDelayedTask(const tracked_objects::Location& from_here,
- const Closure& task,
+ Closure task,
TimeDelta delay) override {
num_of_post_tasks_++;
if (enabled_) {
return worker_pool_.pool()->PostSequencedWorkerTask(token_, from_here,
- task);
+ std::move(task));
}
return false;
}
« no previous file with comments | « base/threading/worker_pool_win.cc ('k') | cc/test/ordered_simple_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698