diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:21:01 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:59:35 -0400 |
commit | c36f9ecb91e49da7e637863889804fc4e6c6c05e (patch) | |
tree | 64d8aadb6d29042d4f4e7366bc1457e4e0612383 /src/mongo/executor | |
parent | c9548e729c8fecd9d7a9a5dd341da0433194ac73 (diff) | |
download | mongo-c36f9ecb91e49da7e637863889804fc4e6c6c05e.tar.gz |
SERVER-39339 Remove `stdx/memory.h`
Diffstat (limited to 'src/mongo/executor')
15 files changed, 53 insertions, 47 deletions
diff --git a/src/mongo/executor/async_timer_mock.cpp b/src/mongo/executor/async_timer_mock.cpp index 0ba1712a189..6a796b684e7 100644 --- a/src/mongo/executor/async_timer_mock.cpp +++ b/src/mongo/executor/async_timer_mock.cpp @@ -29,8 +29,9 @@ #include "mongo/executor/async_timer_mock.h" +#include <memory> + #include "mongo/base/system_error.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { @@ -135,7 +136,7 @@ void AsyncTimerMock::expireAfter(Milliseconds expiration) { std::unique_ptr<AsyncTimerInterface> AsyncTimerFactoryMock::make(Milliseconds expiration) { stdx::lock_guard<stdx::recursive_mutex> lk(_timersMutex); auto elem = _timers.emplace(std::make_shared<AsyncTimerMockImpl>(expiration)); - return stdx::make_unique<AsyncTimerMock>(*elem.first); + return std::make_unique<AsyncTimerMock>(*elem.first); } void AsyncTimerFactoryMock::fastForward(Milliseconds time) { diff --git a/src/mongo/executor/connection_pool_test.cpp b/src/mongo/executor/connection_pool_test.cpp index c2220cd95f6..e839371dbcd 100644 --- a/src/mongo/executor/connection_pool_test.cpp +++ b/src/mongo/executor/connection_pool_test.cpp @@ -29,16 +29,16 @@ #include "mongo/platform/basic.h" +#include "mongo/executor/connection_pool_test_fixture.h" + #include <algorithm> +#include <memory> #include <random> #include <stack> #include <tuple> -#include "mongo/executor/connection_pool_test_fixture.h" - #include "mongo/executor/connection_pool.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/executor/connection_pool_test_fixture.cpp b/src/mongo/executor/connection_pool_test_fixture.cpp index 1f6217c6ef3..dd8f4012388 100644 --- a/src/mongo/executor/connection_pool_test_fixture.cpp +++ b/src/mongo/executor/connection_pool_test_fixture.cpp @@ -31,7 +31,8 @@ #include "mongo/executor/connection_pool_test_fixture.h" -#include "mongo/stdx/memory.h" +#include <memory> + namespace mongo { namespace executor { @@ -226,7 +227,7 @@ std::shared_ptr<ConnectionPool::ConnectionInterface> PoolImpl::makeConnection( } std::shared_ptr<ConnectionPool::TimerInterface> PoolImpl::makeTimer() { - return stdx::make_unique<TimerImpl>(this); + return std::make_unique<TimerImpl>(this); } const std::shared_ptr<OutOfLineExecutor>& PoolImpl::getExecutor() { diff --git a/src/mongo/executor/network_interface_factory.cpp b/src/mongo/executor/network_interface_factory.cpp index 31482720c9f..0489d9adde0 100644 --- a/src/mongo/executor/network_interface_factory.cpp +++ b/src/mongo/executor/network_interface_factory.cpp @@ -31,6 +31,8 @@ #include "mongo/executor/network_interface_factory.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/base/status.h" #include "mongo/config.h" @@ -38,7 +40,6 @@ #include "mongo/executor/network_connection_hook.h" #include "mongo/executor/network_interface_tl.h" #include "mongo/rpc/metadata/metadata_hook.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { diff --git a/src/mongo/executor/network_interface_integration_fixture.cpp b/src/mongo/executor/network_interface_integration_fixture.cpp index 2729326442a..ad2e31fdb03 100644 --- a/src/mongo/executor/network_interface_integration_fixture.cpp +++ b/src/mongo/executor/network_interface_integration_fixture.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/connection_string.h" #include "mongo/executor/network_interface_factory.h" #include "mongo/executor/network_interface_integration_fixture.h" @@ -38,7 +40,6 @@ #include "mongo/executor/task_executor.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/integration_test.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" diff --git a/src/mongo/executor/network_interface_integration_test.cpp b/src/mongo/executor/network_interface_integration_test.cpp index 57371e05545..163415c923c 100644 --- a/src/mongo/executor/network_interface_integration_test.cpp +++ b/src/mongo/executor/network_interface_integration_test.cpp @@ -33,6 +33,7 @@ #include <algorithm> #include <exception> +#include <memory> #include "mongo/base/status_with.h" #include "mongo/client/connection_string.h" @@ -45,7 +46,6 @@ #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/message.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/integration_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -106,7 +106,7 @@ class HangingHook : public executor::NetworkConnectionHook { // Test that we time out a command if the connection hook hangs. TEST_F(NetworkInterfaceIntegrationFixture, HookHangs) { - startNet(stdx::make_unique<HangingHook>()); + startNet(std::make_unique<HangingHook>()); /** * Since mongos's have no ping command, we effectively skip this test by returning diff --git a/src/mongo/executor/network_interface_mock_test.cpp b/src/mongo/executor/network_interface_mock_test.cpp index d31244d368c..d0575679cdd 100644 --- a/src/mongo/executor/network_interface_mock_test.cpp +++ b/src/mongo/executor/network_interface_mock_test.cpp @@ -39,7 +39,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/test_network_connection_hook.h" #include "mongo/executor/thread_pool_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/executor/network_interface_perf_test.cpp b/src/mongo/executor/network_interface_perf_test.cpp index 29eb7ebb84c..205caa22a2a 100644 --- a/src/mongo/executor/network_interface_perf_test.cpp +++ b/src/mongo/executor/network_interface_perf_test.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <exception> +#include <memory> #include "mongo/base/status_with.h" #include "mongo/bson/bsonmisc.h" @@ -42,7 +43,6 @@ #include "mongo/executor/network_interface_asio.h" #include "mongo/executor/network_interface_asio_test_utils.h" #include "mongo/executor/task_executor.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/integration_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -101,8 +101,8 @@ int timeNetworkTestMillis(std::size_t operations, NetworkInterface* net) { TEST(NetworkInterfaceASIO, SerialPerf) { NetworkInterfaceASIO::Options options{}; - options.streamFactory = stdx::make_unique<AsyncStreamFactory>(); - options.timerFactory = stdx::make_unique<AsyncTimerFactoryASIO>(); + options.streamFactory = std::make_unique<AsyncStreamFactory>(); + options.timerFactory = std::make_unique<AsyncTimerFactoryASIO>(); NetworkInterfaceASIO netAsio{std::move(options)}; int duration = timeNetworkTestMillis(numOperations, &netAsio); diff --git a/src/mongo/executor/network_interface_thread_pool_test.cpp b/src/mongo/executor/network_interface_thread_pool_test.cpp index 1f5fef066ab..a166ff5153f 100644 --- a/src/mongo/executor/network_interface_thread_pool_test.cpp +++ b/src/mongo/executor/network_interface_thread_pool_test.cpp @@ -31,11 +31,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/executor/async_timer_mock.h" #include "mongo/executor/network_interface_asio.h" #include "mongo/executor/network_interface_thread_pool.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/concurrency/thread_pool_test_common.h" #include "mongo/util/concurrency/thread_pool_test_fixture.h" @@ -47,9 +48,9 @@ class NetworkInterfaceThreadPoolWithASIO : public ThreadPoolInterface { public: NetworkInterfaceThreadPoolWithASIO() { executor::NetworkInterfaceASIO::Options options; - options.timerFactory = stdx::make_unique<executor::AsyncTimerFactoryMock>(); - _asio = stdx::make_unique<executor::NetworkInterfaceASIO>(std::move(options)); - _pool = stdx::make_unique<executor::NetworkInterfaceThreadPool>(_asio.get()); + options.timerFactory = std::make_unique<executor::AsyncTimerFactoryMock>(); + _asio = std::make_unique<executor::NetworkInterfaceASIO>(std::move(options)); + _pool = std::make_unique<executor::NetworkInterfaceThreadPool>(_asio.get()); _asio->startup(); } @@ -80,7 +81,7 @@ private: MONGO_INITIALIZER(ThreadPoolCommonTests)(InitializerContext*) { addTestsForThreadPool("ThreadPoolCommon", - []() { return stdx::make_unique<NetworkInterfaceThreadPoolWithASIO>(); }); + []() { return std::make_unique<NetworkInterfaceThreadPoolWithASIO>(); }); return Status::OK(); } diff --git a/src/mongo/executor/task_executor.h b/src/mongo/executor/task_executor.h index 92aad54a22a..2cceb303a56 100644 --- a/src/mongo/executor/task_executor.h +++ b/src/mongo/executor/task_executor.h @@ -30,6 +30,7 @@ #pragma once #include <functional> +#include <functional> #include <memory> #include <string> diff --git a/src/mongo/executor/task_executor_test_common.cpp b/src/mongo/executor/task_executor_test_common.cpp index cd38281d267..02cc4367bba 100644 --- a/src/mongo/executor/task_executor_test_common.cpp +++ b/src/mongo/executor/task_executor_test_common.cpp @@ -40,7 +40,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/task_executor.h" #include "mongo/executor/task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/stdx/unordered_map.h" #include "mongo/unittest/unittest.h" @@ -93,20 +92,20 @@ public: } }; -#define COMMON_EXECUTOR_TEST(TEST_NAME) \ - class CET_##TEST_NAME : public CommonTaskExecutorTestFixture { \ - public: \ - CET_##TEST_NAME(ExecutorFactory makeExecutor) \ - : CommonTaskExecutorTestFixture(std::move(makeExecutor)) {} \ - \ - private: \ - void _doTest() override; \ - static const CetRegistrationAgent _agent; \ - }; \ - const CetRegistrationAgent CET_##TEST_NAME::_agent( \ - #TEST_NAME, [](ExecutorFactory makeExecutor) { \ - return stdx::make_unique<CET_##TEST_NAME>(std::move(makeExecutor)); \ - }); \ +#define COMMON_EXECUTOR_TEST(TEST_NAME) \ + class CET_##TEST_NAME : public CommonTaskExecutorTestFixture { \ + public: \ + CET_##TEST_NAME(ExecutorFactory makeExecutor) \ + : CommonTaskExecutorTestFixture(std::move(makeExecutor)) {} \ + \ + private: \ + void _doTest() override; \ + static const CetRegistrationAgent _agent; \ + }; \ + const CetRegistrationAgent CET_##TEST_NAME::_agent( \ + #TEST_NAME, [](ExecutorFactory makeExecutor) { \ + return std::make_unique<CET_##TEST_NAME>(std::move(makeExecutor)); \ + }); \ void CET_##TEST_NAME::_doTest() auto makeSetStatusClosure(Status* target) { @@ -336,7 +335,7 @@ COMMON_EXECUTOR_TEST(EventWaitingWithTimeoutTest) { auto serviceContext = ServiceContext::make(); - serviceContext->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + serviceContext->setFastClockSource(std::make_unique<ClockSourceMock>()); auto mockClock = static_cast<ClockSourceMock*>(serviceContext->getFastClockSource()); auto client = serviceContext->makeClient("for testing"); @@ -358,7 +357,7 @@ COMMON_EXECUTOR_TEST(EventSignalWithTimeoutTest) { auto serviceContext = ServiceContext::make(); - serviceContext->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + serviceContext->setFastClockSource(std::make_unique<ClockSourceMock>()); auto mockClock = static_cast<ClockSourceMock*>(serviceContext->getFastClockSource()); auto client = serviceContext->makeClient("for testing"); diff --git a/src/mongo/executor/task_executor_test_fixture.cpp b/src/mongo/executor/task_executor_test_fixture.cpp index b1286e600d3..085c9aef560 100644 --- a/src/mongo/executor/task_executor_test_fixture.cpp +++ b/src/mongo/executor/task_executor_test_fixture.cpp @@ -31,10 +31,11 @@ #include "mongo/executor/task_executor_test_fixture.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/remote_command_request.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -61,7 +62,7 @@ RemoteCommandRequest TaskExecutorTest::assertRemoteCommandNameEquals( TaskExecutorTest::~TaskExecutorTest() = default; void TaskExecutorTest::setUp() { - auto net = stdx::make_unique<NetworkInterfaceMock>(); + auto net = std::make_unique<NetworkInterfaceMock>(); _net = net.get(); _executor = makeTaskExecutor(std::move(net)); } diff --git a/src/mongo/executor/test_network_connection_hook.h b/src/mongo/executor/test_network_connection_hook.h index d1cc11b8626..5a22ac24f54 100644 --- a/src/mongo/executor/test_network_connection_hook.h +++ b/src/mongo/executor/test_network_connection_hook.h @@ -32,7 +32,6 @@ #include "mongo/base/status_with.h" #include "mongo/executor/network_connection_hook.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { @@ -80,9 +79,9 @@ template <typename Val, typename Req, typename Rep> std::unique_ptr<TestConnectionHook<Val, Req, Rep>> makeTestHook(Val&& validateFunc, Req&& requestFunc, Rep&& replyFunc) { - return stdx::make_unique<TestConnectionHook<Val, Req, Rep>>(std::forward<Val>(validateFunc), - std::forward<Req>(requestFunc), - std::forward<Rep>(replyFunc)); + return std::make_unique<TestConnectionHook<Val, Req, Rep>>(std::forward<Val>(validateFunc), + std::forward<Req>(requestFunc), + std::forward<Rep>(replyFunc)); } } // namespace executor diff --git a/src/mongo/executor/thread_pool_task_executor_test.cpp b/src/mongo/executor/thread_pool_task_executor_test.cpp index b487cc87a41..ed458e50a7c 100644 --- a/src/mongo/executor/thread_pool_task_executor_test.cpp +++ b/src/mongo/executor/thread_pool_task_executor_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/checked_cast.h" #include "mongo/base/init.h" #include "mongo/base/status.h" @@ -39,7 +41,6 @@ #include "mongo/executor/thread_pool_mock.h" #include "mongo/executor/thread_pool_task_executor.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp b/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp index ba35b1963e9..ce0efbda2da 100644 --- a/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp +++ b/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp @@ -31,8 +31,9 @@ #include "mongo/executor/thread_pool_task_executor_test_fixture.h" +#include <memory> + #include "mongo/executor/thread_pool_mock.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { @@ -40,8 +41,8 @@ namespace executor { std::unique_ptr<ThreadPoolTaskExecutor> makeThreadPoolTestExecutor( std::unique_ptr<NetworkInterfaceMock> net, ThreadPoolMock::Options options) { auto netPtr = net.get(); - return stdx::make_unique<ThreadPoolTaskExecutor>( - stdx::make_unique<ThreadPoolMock>(netPtr, 1, std::move(options)), std::move(net)); + return std::make_unique<ThreadPoolTaskExecutor>( + std::make_unique<ThreadPoolMock>(netPtr, 1, std::move(options)), std::move(net)); } ThreadPoolExecutorTest::ThreadPoolExecutorTest() {} |