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

Unified Diff: base/message_loop/message_loop_test.cc

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years, 1 month 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/message_loop/message_loop.cc ('k') | base/metrics/histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop_test.cc
diff --git a/base/message_loop/message_loop_test.cc b/base/message_loop/message_loop_test.cc
index a544a70393f68e4dfa9fe566a8b508e238c3f42a..f82122058916e9785d7e999e02c5e72003efccc9 100644
--- a/base/message_loop/message_loop_test.cc
+++ b/base/message_loop/message_loop_test.cc
@@ -4,6 +4,8 @@
#include "base/message_loop/message_loop_test.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
@@ -87,7 +89,7 @@ void RecordRunTimeFunc(Time* run_time, int* quit_counter) {
void RunTest_PostTask(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Add tests to message loop
scoped_refptr<Foo> foo(new Foo());
std::string a("a"), b("b"), c("c"), d("d");
@@ -117,7 +119,7 @@ void RunTest_PostTask(MessagePumpFactory factory) {
void RunTest_PostDelayedTask_Basic(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Test that PostDelayedTask results in a delayed task.
@@ -140,7 +142,7 @@ void RunTest_PostDelayedTask_Basic(MessagePumpFactory factory) {
void RunTest_PostDelayedTask_InDelayOrder(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Test that two tasks with different delays run in the right order.
int num_tasks = 2;
@@ -165,7 +167,7 @@ void RunTest_PostDelayedTask_InDelayOrder(MessagePumpFactory factory) {
void RunTest_PostDelayedTask_InPostOrder(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Test that two tasks with the same delay run in the order in which they
// were posted.
@@ -195,7 +197,7 @@ void RunTest_PostDelayedTask_InPostOrder(MessagePumpFactory factory) {
void RunTest_PostDelayedTask_InPostOrder_2(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Test that a delayed task still runs after a normal tasks even if the
// normal tasks take a long time to run.
@@ -222,7 +224,7 @@ void RunTest_PostDelayedTask_InPostOrder_2(MessagePumpFactory factory) {
void RunTest_PostDelayedTask_InPostOrder_3(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Test that a delayed task still runs after a pile of normal tasks. The key
// difference between this test and the previous one is that here we return
@@ -250,7 +252,7 @@ void RunTest_PostDelayedTask_InPostOrder_3(MessagePumpFactory factory) {
void RunTest_PostDelayedTask_SharedTimer(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// Test that the interval of the timer, used to run the next delayed task, is
// set to a value corresponding to when the next delayed task should run.
@@ -317,7 +319,7 @@ void RunTest_EnsureDeletion(MessagePumpFactory factory) {
bool b_was_deleted = false;
{
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
loop.PostTask(
FROM_HERE, Bind(&RecordDeletionProbe::Run,
new RecordDeletionProbe(NULL, &a_was_deleted)));
@@ -337,7 +339,7 @@ void RunTest_EnsureDeletion_Chain(MessagePumpFactory factory) {
bool c_was_deleted = false;
{
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
// The scoped_refptr for each of the below is held either by the chained
// RecordDeletionProbe, or the bound RecordDeletionProbe::Run() callback.
RecordDeletionProbe* a = new RecordDeletionProbe(NULL, &a_was_deleted);
@@ -364,7 +366,7 @@ void NestingFunc(int* depth) {
void RunTest_Nesting(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
int depth = 100;
MessageLoop::current()->PostTask(FROM_HERE,
@@ -472,7 +474,7 @@ void QuitFunc(TaskList* order, int cookie) {
}
void RunTest_RecursiveDenial1(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
EXPECT_TRUE(MessageLoop::current()->NestableTasksAllowed());
TaskList order;
@@ -519,7 +521,7 @@ void OrderedFunc(TaskList* order, int cookie) {
void RunTest_RecursiveDenial3(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
EXPECT_TRUE(MessageLoop::current()->NestableTasksAllowed());
TaskList order;
@@ -560,7 +562,7 @@ void RunTest_RecursiveDenial3(MessagePumpFactory factory) {
void RunTest_RecursiveSupport1(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
MessageLoop::current()->PostTask(
@@ -593,7 +595,7 @@ void RunTest_RecursiveSupport1(MessagePumpFactory factory) {
// Tests that non nestable tasks run in FIFO if there are no nested loops.
void RunTest_NonNestableWithNoNesting(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -635,7 +637,7 @@ void SleepFunc(TaskList* order, int cookie, TimeDelta delay) {
void RunTest_NonNestableInNestedLoop(MessagePumpFactory factory,
bool use_delayed) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -703,7 +705,7 @@ void FuncThatQuitsNow() {
// Tests RunLoopQuit only quits the corresponding MessageLoop::Run.
void RunTest_QuitNow(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -738,7 +740,7 @@ void RunTest_QuitNow(MessagePumpFactory factory) {
// Tests RunLoopQuit only quits the corresponding MessageLoop::Run.
void RunTest_RunLoopQuitTop(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -768,7 +770,7 @@ void RunTest_RunLoopQuitTop(MessagePumpFactory factory) {
// Tests RunLoopQuit only quits the corresponding MessageLoop::Run.
void RunTest_RunLoopQuitNested(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -798,7 +800,7 @@ void RunTest_RunLoopQuitNested(MessagePumpFactory factory) {
// Tests RunLoopQuit only quits the corresponding MessageLoop::Run.
void RunTest_RunLoopQuitBogus(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -831,7 +833,7 @@ void RunTest_RunLoopQuitBogus(MessagePumpFactory factory) {
// Tests RunLoopQuit only quits the corresponding MessageLoop::Run.
void RunTest_RunLoopQuitDeep(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -900,7 +902,7 @@ void RunTest_RunLoopQuitDeep(MessagePumpFactory factory) {
// Tests RunLoopQuit works before RunWithID.
void RunTest_RunLoopQuitOrderBefore(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -921,7 +923,7 @@ void RunTest_RunLoopQuitOrderBefore(MessagePumpFactory factory) {
// Tests RunLoopQuit works during RunWithID.
void RunTest_RunLoopQuitOrderDuring(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -948,7 +950,7 @@ void RunTest_RunLoopQuitOrderDuring(MessagePumpFactory factory) {
// Tests RunLoopQuit works after RunWithID.
void RunTest_RunLoopQuitOrderAfter(MessagePumpFactory factory) {
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
TaskList order;
@@ -1006,7 +1008,7 @@ void PostNTasksThenQuit(int posts_remaining) {
void RunTest_RecursivePosts(MessagePumpFactory factory) {
const int kNumTimes = 1 << 17;
scoped_ptr<MessagePump> pump(factory());
- MessageLoop loop(pump.Pass());
+ MessageLoop loop(std::move(pump));
loop.PostTask(FROM_HERE, Bind(&PostNTasksThenQuit, kNumTimes));
loop.Run();
}
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698