[K/N] Remove usage of legacy allocation stuff ^KT-52130

Merge-request: KT-MR-6182
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2022-04-29 10:12:44 +00:00
committed by Space
parent cb35e868cc
commit 4a66cd0c69
73 changed files with 590 additions and 593 deletions
@@ -10,6 +10,8 @@
#include "KAssert.h"
#include "TestSupport.hpp"
#include "std_support/Memory.hpp"
#include "std_support/Vector.hpp"
using namespace kotlin;
@@ -60,7 +62,7 @@ TEST(SingleThreadExecutorTest, ContextThreadBound) {
createdContext = &context;
createdThread = std::this_thread::get_id();
});
auto executor = ::make_unique<SingleThreadExecutor<PinnedContext>>();
auto executor = std_support::make_unique<SingleThreadExecutor<PinnedContext>>();
// Make sure context is created.
executor->context();
testing::Mock::VerifyAndClearExpectations(&mocks.ctorMock);
@@ -127,7 +129,7 @@ TEST(SingleThreadExecutorTest, execute) {
TEST(SingleThreadExecutorTest, DropExecutorWithTasks) {
struct Context {};
auto executor = make_unique<SingleThreadExecutor<Context>>();
auto executor = std_support::make_unique<SingleThreadExecutor<Context>>();
std::mutex taskMutex;
testing::StrictMock<testing::MockFunction<void()>> task;
@@ -141,7 +143,7 @@ TEST(SingleThreadExecutorTest, DropExecutorWithTasks) {
auto future = executor->execute(task.AsStdFunction());
while (!taskStarted) {}
KStdVector<std::pair<std::future<void>, bool>> newTasks;
std_support::vector<std::pair<std::future<void>, bool>> newTasks;
constexpr size_t tasksCount = 100;
for (size_t i = 0; i < tasksCount; ++i) {
newTasks.push_back(std::make_pair(executor->execute([&newTasks, i] { newTasks[i].second = true; }), false));
@@ -165,14 +167,14 @@ TEST(SingleThreadExecutorTest, DropExecutorWithTasks) {
TEST(SingleThreadExecutorTest, ExecuteFromManyThreads) {
struct Context {
KStdVector<int> result;
std_support::vector<int> result;
};
SingleThreadExecutor<Context> executor;
std::atomic_bool canStart = false;
KStdVector<int> expected;
KStdVector<ScopedThread> threads;
std_support::vector<int> expected;
std_support::vector<ScopedThread> threads;
for (int i = 0; i < kDefaultThreadCount; ++i) {
expected.push_back(i);
threads.emplace_back([&, i] {