summaryrefslogtreecommitdiff
path: root/src/mongo/executor
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2017-01-25 13:12:37 -0500
committerAndy Schwerin <schwerin@mongodb.com>2017-01-25 13:12:37 -0500
commit60185f785b617c775fd15cd6c7212373d936f0d5 (patch)
tree04a350ace79e26ff6938ff27604a5558aa181382 /src/mongo/executor
parentef208c94e55a04978b9b5dede6764a7b6c587b41 (diff)
downloadmongo-60185f785b617c775fd15cd6c7212373d936f0d5.tar.gz
SERVER-27800 Change ReplicationCoordinatorImpl and ReplicationExecutor constructors to take owned objects by unique_ptr
The constructors of ReplicationCoordinatorImpl and ReplicationExecutor predate C++11 support in the MongoDB codebase, and so receive bare pointers to objects that they actually own. This patch is to changes the constructors and some of the associated test infrastructure to transfer ownership by passing unique_ptr, as in more modern components.
Diffstat (limited to 'src/mongo/executor')
-rw-r--r--src/mongo/executor/task_executor_test_common.cpp4
-rw-r--r--src/mongo/executor/task_executor_test_common.h2
-rw-r--r--src/mongo/executor/thread_pool_task_executor_test.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/executor/task_executor_test_common.cpp b/src/mongo/executor/task_executor_test_common.cpp
index 57c12813250..94984a32381 100644
--- a/src/mongo/executor/task_executor_test_common.cpp
+++ b/src/mongo/executor/task_executor_test_common.cpp
@@ -51,7 +51,7 @@ namespace executor {
namespace {
using ExecutorFactory =
- stdx::function<std::unique_ptr<TaskExecutor>(std::unique_ptr<NetworkInterfaceMock>*)>;
+ stdx::function<std::unique_ptr<TaskExecutor>(std::unique_ptr<NetworkInterfaceMock>)>;
class CommonTaskExecutorTestFixture : public TaskExecutorTest {
public:
@@ -61,7 +61,7 @@ public:
private:
std::unique_ptr<TaskExecutor> makeTaskExecutor(
std::unique_ptr<NetworkInterfaceMock> net) override {
- return _makeExecutor(&net);
+ return _makeExecutor(std::move(net));
}
ExecutorFactory _makeExecutor;
diff --git a/src/mongo/executor/task_executor_test_common.h b/src/mongo/executor/task_executor_test_common.h
index b9fd7e7235c..0f4895f5ae4 100644
--- a/src/mongo/executor/task_executor_test_common.h
+++ b/src/mongo/executor/task_executor_test_common.h
@@ -51,7 +51,7 @@ class TaskExecutor;
*/
void addTestsForExecutor(const std::string& suiteName,
stdx::function<std::unique_ptr<TaskExecutor>(
- std::unique_ptr<NetworkInterfaceMock>*)> makeExecutor);
+ std::unique_ptr<NetworkInterfaceMock>)> makeExecutor);
} // namespace executor
} // namespace mongo
diff --git a/src/mongo/executor/thread_pool_task_executor_test.cpp b/src/mongo/executor/thread_pool_task_executor_test.cpp
index 350c475ed01..db0cc594f42 100644
--- a/src/mongo/executor/thread_pool_task_executor_test.cpp
+++ b/src/mongo/executor/thread_pool_task_executor_test.cpp
@@ -48,8 +48,8 @@ namespace executor {
namespace {
MONGO_INITIALIZER(ThreadPoolExecutorCommonTests)(InitializerContext*) {
- addTestsForExecutor("ThreadPoolExecutorCommon", [](std::unique_ptr<NetworkInterfaceMock>* net) {
- return makeThreadPoolTestExecutor(std::move(*net));
+ addTestsForExecutor("ThreadPoolExecutorCommon", [](std::unique_ptr<NetworkInterfaceMock> net) {
+ return makeThreadPoolTestExecutor(std::move(net));
});
return Status::OK();
}