Codemod folly::make_unique to std::make_unique
authorChristopher Dykes <cdykes@fb.com>
Tue, 9 May 2017 01:16:18 +0000 (18:16 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 9 May 2017 01:20:21 +0000 (18:20 -0700)
Summary: There are still some upstream references to `folly::make_unique` that need to be removed before it can be full killed, but this gets it most of the way there.

Reviewed By: yfeldblum

Differential Revision: D5024310

fbshipit-source-id: 6cfe8ea93662be18bb55588c8200dec72946e205

42 files changed:
folly/AtomicLinkedList.h
folly/Try-inl.h
folly/Try.h
folly/experimental/TestUtil.cpp
folly/experimental/test/FutureDAGTest.cpp
folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp
folly/experimental/test/ReadMostlySharedPtrTest.cpp
folly/experimental/test/TestUtilTest.cpp
folly/fibers/FiberManager.cpp
folly/fibers/FiberManagerInternal-inl.h
folly/fibers/FiberManagerInternal.h
folly/fibers/GuardPageAllocator.cpp
folly/fibers/TimeoutController.cpp
folly/fibers/test/FibersBenchmark.cpp
folly/fibers/test/FibersTest.cpp
folly/fibers/test/FibersTestApp.cpp
folly/futures/Future-inl.h
folly/futures/detail/Core.h
folly/futures/test/FilterTest.cpp
folly/futures/test/FutureTest.cpp
folly/futures/test/NonCopyableLambdaTest.cpp
folly/futures/test/PromiseTest.cpp
folly/futures/test/ViaTest.cpp
folly/gen/test/BaseTest.cpp
folly/io/async/AsyncSSLSocket.cpp
folly/io/async/AsyncSocket.cpp
folly/io/async/EventBase.cpp
folly/io/async/HHWheelTimer.cpp
folly/io/async/TimeoutManager.cpp
folly/io/async/test/AsyncSSLSocketTest.cpp
folly/io/async/test/AsyncSocketTest2.cpp
folly/io/async/test/AsyncUDPSocketTest.cpp
folly/io/async/test/EventBaseTest.cpp
folly/io/async/test/RequestContextTest.cpp
folly/io/async/test/SSLSessionTest.cpp
folly/io/async/test/ScopedBoundPort.cpp
folly/ssl/SSLSession.h
folly/test/AHMIntStressTest.cpp
folly/test/FunctionTest.cpp
folly/test/MPMCQueueTest.cpp
folly/test/ThreadLocalTest.cpp
folly/test/TryTest.cpp

index 3ee27bbb1e3befbdf0806f93d1c487015c4367d4..4d1d8503452ad6683be6a8fc479a4f343bf16d9f 100644 (file)
@@ -54,7 +54,7 @@ class AtomicLinkedList {
    *         after the call.
    */
   bool insertHead(T t) {
-    auto wrapper = folly::make_unique<Wrapper>(std::move(t));
+    auto wrapper = std::make_unique<Wrapper>(std::move(t));
 
     return list_.insertHead(wrapper.release());
   }
index 7411ec90308e99c874b2a9c2cd3eef8b9924ca9d..92f8f59aeafc6235544e7d817a6e5bbce6751f51 100644 (file)
@@ -41,7 +41,7 @@ Try<T>::Try(typename std::enable_if<std::is_same<Unit, T2>::value,
   } else if (t.hasException()) {
     contains_ = Contains::EXCEPTION;
     new (&e_) std::unique_ptr<exception_wrapper>(
-        folly::make_unique<exception_wrapper>(t.exception()));
+        std::make_unique<exception_wrapper>(t.exception()));
   }
 }
 
@@ -71,7 +71,7 @@ Try<T>::Try(const Try<T>& t) {
     new (&value_)T(t.value_);
   } else if (contains_ == Contains::EXCEPTION) {
     new (&e_)std::unique_ptr<exception_wrapper>();
-    e_ = folly::make_unique<exception_wrapper>(*(t.e_));
+    e_ = std::make_unique<exception_wrapper>(*(t.e_));
   }
 }
 
@@ -86,7 +86,7 @@ Try<T>& Try<T>::operator=(const Try<T>& t) {
     new (&value_)T(t.value_);
   } else if (contains_ == Contains::EXCEPTION) {
     new (&e_)std::unique_ptr<exception_wrapper>();
-    e_ = folly::make_unique<exception_wrapper>(*(t.e_));
+    e_ = std::make_unique<exception_wrapper>(*(t.e_));
   }
   return *this;
 }
index 230c658cac1bd6acc38a75fef78d01006b981a6b..86a5dee003c9b37b98e4312c900fd96943ac0aba 100644 (file)
@@ -93,8 +93,8 @@ class Try {
    * @param e The exception_wrapper
    */
   explicit Try(exception_wrapper e)
-    : contains_(Contains::EXCEPTION),
-      e_(folly::make_unique<exception_wrapper>(std::move(e))) {}
+      : contains_(Contains::EXCEPTION),
+        e_(std::make_unique<exception_wrapper>(std::move(e))) {}
 
   /*
    * DEPRECATED
@@ -108,9 +108,9 @@ class Try {
     try {
       std::rethrow_exception(ep);
     } catch (const std::exception& e) {
-      e_ = folly::make_unique<exception_wrapper>(std::current_exception(), e);
+      e_ = std::make_unique<exception_wrapper>(std::current_exception(), e);
     } catch (...) {
-      e_ = folly::make_unique<exception_wrapper>(std::current_exception());
+      e_ = std::make_unique<exception_wrapper>(std::current_exception());
     }
   }
 
@@ -266,8 +266,8 @@ class Try<void> {
    * @param e The exception_wrapper
    */
   explicit Try(exception_wrapper e)
-    : hasValue_(false),
-      e_(folly::make_unique<exception_wrapper>(std::move(e))) {}
+      : hasValue_(false),
+        e_(std::make_unique<exception_wrapper>(std::move(e))) {}
 
   /*
    * DEPRECATED
@@ -280,9 +280,9 @@ class Try<void> {
     try {
       std::rethrow_exception(ep);
     } catch (const std::exception& e) {
-      e_ = folly::make_unique<exception_wrapper>(std::current_exception(), e);
+      e_ = std::make_unique<exception_wrapper>(std::current_exception(), e);
     } catch (...) {
-      e_ = folly::make_unique<exception_wrapper>(std::current_exception());
+      e_ = std::make_unique<exception_wrapper>(std::current_exception());
     }
   }
 
@@ -290,7 +290,7 @@ class Try<void> {
   Try& operator=(const Try<void>& t) {
     hasValue_ = t.hasValue_;
     if (t.e_) {
-      e_ = folly::make_unique<exception_wrapper>(*t.e_);
+      e_ = std::make_unique<exception_wrapper>(*t.e_);
     }
     return *this;
   }
index afbf25a7a36321c68fa132cf76ea01cf9b1af28c..91410a55a81a940a58b1001121da2466ced24f54 100644 (file)
@@ -102,7 +102,7 @@ TemporaryDirectory::TemporaryDirectory(
     fs::path dir,
     Scope scope)
     : scope_(scope),
-      path_(folly::make_unique<fs::path>(
+      path_(std::make_unique<fs::path>(
           generateUniquePath(std::move(dir), namePrefix))) {
   fs::create_directory(path());
 }
index 1e4cf88805036810f741ec73044750d579b701fb..98329c9035e0cb7ca07afb813e2813690fe79b9d 100644 (file)
@@ -23,7 +23,7 @@ struct FutureDAGTest : public testing::Test {
   typedef FutureDAG::Handle Handle;
 
   Handle add() {
-    auto node = folly::make_unique<TestNode>(this);
+    auto node = std::make_unique<TestNode>(this);
     auto handle = node->handle;
     nodes.emplace(handle, std::move(node));
     return handle;
index 70604a33bb7f760bd85c3cf16be76e22d04c672e..b1139f24939b158474b12aa9629ca8768990e78b 100644 (file)
@@ -29,7 +29,7 @@ template <template<typename> class MainPtr,
           template<typename> class WeakPtr,
           size_t threadCount>
 void benchmark(size_t n) {
-  MainPtr<int> mainPtr(folly::make_unique<int>(42));
+  MainPtr<int> mainPtr(std::make_unique<int>(42));
 
   std::vector<std::thread> ts;
 
index 8b3140e997f48251c5a67ed1e40d7c9caa796cdb..ba85eb0ba47ee63c4b29a5349f9a93240e483c2f 100644 (file)
@@ -84,12 +84,12 @@ TEST_F(ReadMostlySharedPtrTest, BasicStores) {
 
   // Store 1.
   std::atomic<int> cnt1{0};
-  ptr.reset(folly::make_unique<TestObject>(1, cnt1));
+  ptr.reset(std::make_unique<TestObject>(1, cnt1));
   EXPECT_EQ(1, cnt1.load());
 
   // Store 2, check that 1 is destroyed.
   std::atomic<int> cnt2{0};
-  ptr.reset(folly::make_unique<TestObject>(2, cnt2));
+  ptr.reset(std::make_unique<TestObject>(2, cnt2));
   EXPECT_EQ(1, cnt2.load());
   EXPECT_EQ(0, cnt1.load());
 
@@ -109,13 +109,13 @@ TEST_F(ReadMostlySharedPtrTest, BasicLoads) {
     EXPECT_EQ(ptr.get(), nullptr);
 
     std::atomic<int> cnt1{0};
-    ptr.reset(folly::make_unique<TestObject>(1, cnt1));
+    ptr.reset(std::make_unique<TestObject>(1, cnt1));
     EXPECT_EQ(1, cnt1.load());
 
     x = ptr;
     EXPECT_EQ(1, x->value);
 
-    ptr.reset(folly::make_unique<TestObject>(2, cnt2));
+    ptr.reset(std::make_unique<TestObject>(2, cnt2));
     EXPECT_EQ(1, cnt2.load());
     EXPECT_EQ(1, cnt1.load());
 
@@ -174,18 +174,18 @@ TEST_F(ReadMostlySharedPtrTest, LoadsFromThreads) {
 
     loads[0].requestAndWait();
 
-    ptr.reset(folly::make_unique<TestObject>(1, cnt));
+    ptr.reset(std::make_unique<TestObject>(1, cnt));
     loads[1].requestAndWait();
 
-    ptr.reset(folly::make_unique<TestObject>(2, cnt));
+    ptr.reset(std::make_unique<TestObject>(2, cnt));
     loads[2].requestAndWait();
     loads[3].requestAndWait();
 
-    ptr.reset(folly::make_unique<TestObject>(3, cnt));
-    ptr.reset(folly::make_unique<TestObject>(4, cnt));
+    ptr.reset(std::make_unique<TestObject>(3, cnt));
+    ptr.reset(std::make_unique<TestObject>(4, cnt));
     loads[4].requestAndWait();
 
-    ptr.reset(folly::make_unique<TestObject>(5, cnt));
+    ptr.reset(std::make_unique<TestObject>(5, cnt));
     loads[5].requestAndWait();
     loads[6].requestAndWait();
 
@@ -201,8 +201,7 @@ TEST_F(ReadMostlySharedPtrTest, LoadsFromThreads) {
 TEST_F(ReadMostlySharedPtrTest, Ctor) {
   std::atomic<int> cnt1{0};
   {
-    ReadMostlyMainPtr<TestObject> ptr(
-      folly::make_unique<TestObject>(1, cnt1));
+    ReadMostlyMainPtr<TestObject> ptr(std::make_unique<TestObject>(1, cnt1));
 
     EXPECT_EQ(1, ptr.getShared()->value);
   }
@@ -217,7 +216,7 @@ TEST_F(ReadMostlySharedPtrTest, ClearingCache) {
   ReadMostlyMainPtr<TestObject> ptr;
 
   // Store 1.
-  ptr.reset(folly::make_unique<TestObject>(1, cnt1));
+  ptr.reset(std::make_unique<TestObject>(1, cnt1));
 
   Coordinator c;
 
@@ -232,7 +231,7 @@ TEST_F(ReadMostlySharedPtrTest, ClearingCache) {
   EXPECT_EQ(1, cnt1.load());
 
   // Store 2 and check that 1 is destroyed.
-  ptr.reset(folly::make_unique<TestObject>(2, cnt2));
+  ptr.reset(std::make_unique<TestObject>(2, cnt2));
   EXPECT_EQ(0, cnt1.load());
 
   // Unblock thread.
index cbae58154febf618c304f4813dc7c29b2607ad94..32196eccdac83c9d320612faa5db1065696f8321 100644 (file)
@@ -118,7 +118,7 @@ TEST(TemporaryDirectory, SafelyMove) {
     expectTempdirExists(d);
     expectTempdirExists(d2);
 
-    dir = folly::make_unique<TemporaryDirectory>(std::move(d));
+    dir = std::make_unique<TemporaryDirectory>(std::move(d));
     dir2 = std::move(d2);
   }
 
index 8a04bde1132245840bfb95f27d0e2974b538aff3..054ed1713a6433961522504f7a4ab74211a0c9e1 100644 (file)
@@ -335,7 +335,7 @@ class ScopedAlternateSignalStack {
       return;
     }
 
-    stack_ = folly::make_unique<AltStackBuffer>();
+    stack_ = std::make_unique<AltStackBuffer>();
 
     setAlternateStack(stack_->data(), stack_->size());
   }
index df354aaa4070a9b7933758ea31f83695f08fd639..862e6a30099e88713ff4dd8d0d5928337b073d08 100644 (file)
@@ -313,10 +313,10 @@ void FiberManager::addTaskRemote(F&& func) {
     auto currentFm = getFiberManagerUnsafe();
     if (currentFm && currentFm->currentFiber_ &&
         currentFm->localType_ == localType_) {
-      return folly::make_unique<RemoteTask>(
+      return std::make_unique<RemoteTask>(
           std::forward<F>(func), currentFm->currentFiber_->localData_);
     }
-    return folly::make_unique<RemoteTask>(std::forward<F>(func));
+    return std::make_unique<RemoteTask>(std::forward<F>(func));
   }();
   auto insertHead = [&]() {
     return remoteTaskQueue_.insertHead(task.release());
index 18ec76287b017ff44eaa6d0deb77e56442db3e04..7428d01d3806d65fd1e4aa0b32ae0de49b0195ae 100644 (file)
@@ -337,7 +337,7 @@ class FiberManager : public ::folly::Executor {
     template <typename F>
     RemoteTask(F&& f, const Fiber::LocalData& localData_)
         : func(std::forward<F>(f)),
-          localData(folly::make_unique<Fiber::LocalData>(localData_)),
+          localData(std::make_unique<Fiber::LocalData>(localData_)),
           rcontext(RequestContext::saveContext()) {}
     folly::Function<void()> func;
     std::unique_ptr<Fiber::LocalData> localData;
index fe521a472c74a1b83d2e7a56583a252e3cd5d71d..23194998c85faf919f29988bc63e6061d8f43277 100644 (file)
@@ -245,7 +245,7 @@ class CacheManager {
     std::lock_guard<folly::SpinLock> lg(lock_);
     if (inUse_ < kMaxInUse) {
       ++inUse_;
-      return folly::make_unique<StackCacheEntry>(stackSize);
+      return std::make_unique<StackCacheEntry>(stackSize);
     }
 
     return nullptr;
@@ -277,7 +277,7 @@ class CacheManager {
 class StackCacheEntry {
  public:
   explicit StackCacheEntry(size_t stackSize)
-      : stackCache_(folly::make_unique<StackCache>(stackSize)) {}
+      : stackCache_(std::make_unique<StackCache>(stackSize)) {}
 
   StackCache& cache() const noexcept {
     return *stackCache_;
index ce68e9e16cc86a5037b672b5c926e4be84f0788b..f1bf711b9aa874fcf38024e74b07ed527c88228d 100644 (file)
@@ -33,7 +33,7 @@ intptr_t TimeoutController::registerTimeout(
     }
 
     timeoutHandleBuckets_.emplace_back(
-        duration, folly::make_unique<TimeoutHandleList>());
+        duration, std::make_unique<TimeoutHandleList>());
     return *timeoutHandleBuckets_.back().second;
   }();
 
index 93905851c7fd5a3e266e495ea0529e4270b49fee..40d6cb33af0a9ce5ae36067aca98cb57fad9d7cb 100644 (file)
@@ -31,7 +31,7 @@ static size_t sNumAwaits;
 void runBenchmark(size_t numAwaits, size_t toSend) {
   sNumAwaits = numAwaits;
 
-  FiberManager fiberManager(folly::make_unique<SimpleLoopController>());
+  FiberManager fiberManager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(fiberManager.loopController());
 
@@ -87,7 +87,7 @@ BENCHMARK(FiberManagerAllocateDeallocatePattern, iters) {
   FiberManager::Options opts;
   opts.maxFibersPoolSize = 0;
 
-  FiberManager fiberManager(folly::make_unique<SimpleLoopController>(), opts);
+  FiberManager fiberManager(std::make_unique<SimpleLoopController>(), opts);
 
   for (size_t iter = 0; iter < iters; ++iter) {
     DCHECK_EQ(0, fiberManager.fibersPoolSize());
@@ -110,7 +110,7 @@ BENCHMARK(FiberManagerAllocateLargeChunk, iters) {
   FiberManager::Options opts;
   opts.maxFibersPoolSize = 0;
 
-  FiberManager fiberManager(folly::make_unique<SimpleLoopController>(), opts);
+  FiberManager fiberManager(std::make_unique<SimpleLoopController>(), opts);
 
   for (size_t iter = 0; iter < iters; ++iter) {
     DCHECK_EQ(0, fiberManager.fibersPoolSize());
index b3d32303c91441a475e2256ea4b152a7f49e995b..c193c7f555c22f201f5593b149359f793f8cb82b 100644 (file)
@@ -44,7 +44,7 @@ TEST(FiberManager, batonTimedWaitTimeout) {
   bool taskAdded = false;
   size_t iterations = 0;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -85,7 +85,7 @@ TEST(FiberManager, batonTimedWaitPost) {
   size_t iterations = 0;
   Baton* baton_ptr;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -120,7 +120,7 @@ TEST(FiberManager, batonTimedWaitTimeoutEvb) {
 
   folly::EventBase evb;
 
-  FiberManager manager(folly::make_unique<EventBaseLoopController>());
+  FiberManager manager(std::make_unique<EventBaseLoopController>());
   dynamic_cast<EventBaseLoopController&>(manager.loopController())
       .attachEventBase(evb);
 
@@ -159,7 +159,7 @@ TEST(FiberManager, batonTimedWaitPostEvb) {
 
   folly::EventBase evb;
 
-  FiberManager manager(folly::make_unique<EventBaseLoopController>());
+  FiberManager manager(std::make_unique<EventBaseLoopController>());
   dynamic_cast<EventBaseLoopController&>(manager.loopController())
       .attachEventBase(evb);
 
@@ -192,7 +192,7 @@ TEST(FiberManager, batonTimedWaitPostEvb) {
 }
 
 TEST(FiberManager, batonTryWait) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
 
   // Check if try_wait and post work as expected
   Baton b;
@@ -225,7 +225,7 @@ TEST(FiberManager, batonTryWait) {
 }
 
 TEST(FiberManager, genericBatonFiberWait) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
 
   GenericBaton b;
   bool fiberRunning = false;
@@ -254,7 +254,7 @@ TEST(FiberManager, genericBatonFiberWait) {
 }
 
 TEST(FiberManager, genericBatonThreadWait) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   GenericBaton b;
   std::atomic<bool> threadWaiting(false);
 
@@ -284,7 +284,7 @@ TEST(FiberManager, addTasksNoncopyable) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -297,7 +297,7 @@ TEST(FiberManager, addTasksNoncopyable) {
             await([&pendingFibers](Promise<int> promise) {
               pendingFibers.push_back(std::move(promise));
             });
-            return folly::make_unique<int>(i * 2 + 1);
+            return std::make_unique<int>(i * 2 + 1);
           });
         }
 
@@ -353,7 +353,7 @@ TEST(FiberManager, addTasksThrow) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -405,7 +405,7 @@ TEST(FiberManager, addTasksVoid) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -447,7 +447,7 @@ TEST(FiberManager, addTasksVoidThrow) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -497,7 +497,7 @@ TEST(FiberManager, addTasksReserve) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -587,7 +587,7 @@ TEST(FiberManager, forEach) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -630,7 +630,7 @@ TEST(FiberManager, collectN) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -670,7 +670,7 @@ TEST(FiberManager, collectNThrow) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -709,7 +709,7 @@ TEST(FiberManager, collectNVoid) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -745,7 +745,7 @@ TEST(FiberManager, collectNVoidThrow) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -784,7 +784,7 @@ TEST(FiberManager, collectAll) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -823,7 +823,7 @@ TEST(FiberManager, collectAllVoid) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -858,7 +858,7 @@ TEST(FiberManager, collectAny) {
   std::vector<Promise<int>> pendingFibers;
   bool taskAdded = false;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -918,7 +918,7 @@ void expectMainContext(bool& ran, int* mainLocation, int* fiberLocation) {
 }
 
 TEST(FiberManager, runInMainContext) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -954,7 +954,7 @@ TEST(FiberManager, runInMainContext) {
 }
 
 TEST(FiberManager, addTaskFinally) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -981,7 +981,7 @@ TEST(FiberManager, fibersPoolWithinLimit) {
   FiberManager::Options opts;
   opts.maxFibersPoolSize = 5;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>(), opts);
+  FiberManager manager(std::make_unique<SimpleLoopController>(), opts);
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -1010,7 +1010,7 @@ TEST(FiberManager, fibersPoolOverLimit) {
   FiberManager::Options opts;
   opts.maxFibersPoolSize = 5;
 
-  FiberManager manager(folly::make_unique<SimpleLoopController>(), opts);
+  FiberManager manager(std::make_unique<SimpleLoopController>(), opts);
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -1032,7 +1032,7 @@ TEST(FiberManager, fibersPoolOverLimit) {
 }
 
 TEST(FiberManager, remoteFiberBasic) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -1070,7 +1070,7 @@ TEST(FiberManager, remoteFiberBasic) {
 }
 
 TEST(FiberManager, addTaskRemoteBasic) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
 
   int result[2];
   result[0] = result[1] = 0;
@@ -1111,7 +1111,7 @@ TEST(FiberManager, addTaskRemoteBasic) {
 
 TEST(FiberManager, remoteHasTasks) {
   size_t counter = 0;
-  FiberManager fm(folly::make_unique<SimpleLoopController>());
+  FiberManager fm(std::make_unique<SimpleLoopController>());
   std::thread remote([&]() { fm.addTaskRemote([&]() { ++counter; }); });
 
   remote.join();
@@ -1127,7 +1127,7 @@ TEST(FiberManager, remoteHasTasks) {
 TEST(FiberManager, remoteHasReadyTasks) {
   int result = 0;
   folly::Optional<Promise<int>> savedPromise;
-  FiberManager fm(folly::make_unique<SimpleLoopController>());
+  FiberManager fm(std::make_unique<SimpleLoopController>());
   std::thread remote([&]() {
     fm.addTaskRemote([&]() {
       result = await(
@@ -1154,8 +1154,7 @@ TEST(FiberManager, remoteHasReadyTasks) {
 
 template <typename Data>
 void testFiberLocal() {
-  FiberManager fm(
-      LocalType<Data>(), folly::make_unique<SimpleLoopController>());
+  FiberManager fm(LocalType<Data>(), std::make_unique<SimpleLoopController>());
 
   fm.addTask([]() {
     EXPECT_EQ(42, local<Data>().value);
@@ -1230,7 +1229,7 @@ TEST(FiberManager, fiberLocalDestructor) {
   };
 
   FiberManager fm(
-      LocalType<CrazyData>(), folly::make_unique<SimpleLoopController>());
+      LocalType<CrazyData>(), std::make_unique<SimpleLoopController>());
 
   fm.addTask([]() { local<CrazyData>().data = 41; });
 
@@ -1239,7 +1238,7 @@ TEST(FiberManager, fiberLocalDestructor) {
 }
 
 TEST(FiberManager, yieldTest) {
-  FiberManager manager(folly::make_unique<SimpleLoopController>());
+  FiberManager manager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(manager.loopController());
 
@@ -1260,7 +1259,7 @@ TEST(FiberManager, yieldTest) {
 }
 
 TEST(FiberManager, RequestContext) {
-  FiberManager fm(folly::make_unique<SimpleLoopController>());
+  FiberManager fm(std::make_unique<SimpleLoopController>());
 
   bool checkRun1 = false;
   bool checkRun2 = false;
@@ -1358,7 +1357,7 @@ TEST(FiberManager, resizePeriodically) {
   opts.fibersPoolResizePeriodMs = 300;
   opts.maxFibersPoolSize = 5;
 
-  FiberManager manager(folly::make_unique<EventBaseLoopController>(), opts);
+  FiberManager manager(std::make_unique<EventBaseLoopController>(), opts);
 
   folly::EventBase evb;
   dynamic_cast<EventBaseLoopController&>(manager.loopController())
@@ -1416,7 +1415,7 @@ TEST(FiberManager, resizePeriodically) {
 }
 
 TEST(FiberManager, batonWaitTimeoutHandler) {
-  FiberManager manager(folly::make_unique<EventBaseLoopController>());
+  FiberManager manager(std::make_unique<EventBaseLoopController>());
 
   folly::EventBase evb;
   dynamic_cast<EventBaseLoopController&>(manager.loopController())
@@ -1448,7 +1447,7 @@ TEST(FiberManager, batonWaitTimeoutHandler) {
 }
 
 TEST(FiberManager, batonWaitTimeoutMany) {
-  FiberManager manager(folly::make_unique<EventBaseLoopController>());
+  FiberManager manager(std::make_unique<EventBaseLoopController>());
 
   folly::EventBase evb;
   dynamic_cast<EventBaseLoopController&>(manager.loopController())
@@ -1478,7 +1477,7 @@ TEST(FiberManager, batonWaitTimeoutMany) {
 }
 
 TEST(FiberManager, remoteFutureTest) {
-  FiberManager fiberManager(folly::make_unique<SimpleLoopController>());
+  FiberManager fiberManager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(fiberManager.loopController());
 
@@ -1496,7 +1495,7 @@ TEST(FiberManager, remoteFutureTest) {
 
 // Test that a void function produes a Future<Unit>.
 TEST(FiberManager, remoteFutureVoidUnitTest) {
-  FiberManager fiberManager(folly::make_unique<SimpleLoopController>());
+  FiberManager fiberManager(std::make_unique<SimpleLoopController>());
   auto& loopController =
       dynamic_cast<SimpleLoopController&>(fiberManager.loopController());
 
@@ -1556,7 +1555,7 @@ TEST(FiberManager, semaphore) {
 
   auto task = [&sem, kTasks, kIterations, kNumTokens](
       int& counter, folly::fibers::Baton& baton) {
-    FiberManager manager(folly::make_unique<EventBaseLoopController>());
+    FiberManager manager(std::make_unique<EventBaseLoopController>());
     folly::EventBase evb;
     dynamic_cast<EventBaseLoopController&>(manager.loopController())
         .attachEventBase(evb);
@@ -2048,7 +2047,7 @@ TEST(FiberManager, VirtualEventBase) {
     folly::ScopedEventBaseThread thread;
 
     auto evb1 =
-        folly::make_unique<folly::VirtualEventBase>(*thread.getEventBase());
+        std::make_unique<folly::VirtualEventBase>(*thread.getEventBase());
     auto& evb2 = thread.getEventBase()->getVirtualEventBase();
 
     getFiberManager(*evb1).addTaskRemote([&] {
@@ -2145,7 +2144,7 @@ TEST(FiberManager, recordStack) {
     folly::fibers::FiberManager::Options opts;
     opts.recordStackEvery = 1;
 
-    FiberManager fm(folly::make_unique<SimpleLoopController>(), opts);
+    FiberManager fm(std::make_unique<SimpleLoopController>(), opts);
     auto& loopController =
         dynamic_cast<SimpleLoopController&>(fm.loopController());
 
index f448eeee60e9f077de4770678c3c05c944cdb89f..1c4ca5516ea481867fe0c55af69898757dc4acb5 100644 (file)
@@ -26,7 +26,7 @@ using namespace folly::fibers;
 struct Application {
  public:
   Application()
-      : fiberManager(folly::make_unique<SimpleLoopController>()),
+      : fiberManager(std::make_unique<SimpleLoopController>()),
         toSend(20),
         maxOutstanding(5) {}
 
index b353ff81a411f932c28da12af08239ff7ba48e32..0e6c7e31c40f8e32f1205530844429a84044f203 100644 (file)
@@ -1190,7 +1190,7 @@ Future<Unit> whileDo(P&& predicate, F&& thunk) {
 template <class F>
 Future<Unit> times(const int n, F&& thunk) {
   return folly::whileDo(
-      [ n, count = folly::make_unique<std::atomic<int>>(0) ]() mutable {
+      [ n, count = std::make_unique<std::atomic<int>>(0) ]() mutable {
         return count->fetch_add(1) < n;
       },
       std::forward<F>(thunk));
index 790a45cd3646f427b31e7e86be76537024a3542e..3124cda343b5046d0b8c8faed54de80d8c8d3edc 100644 (file)
@@ -240,7 +240,7 @@ class Core final {
       interruptLock_.lock();
     }
     if (!interrupt_ && !hasResult()) {
-      interrupt_ = folly::make_unique<exception_wrapper>(std::move(e));
+      interrupt_ = std::make_unique<exception_wrapper>(std::move(e));
       if (interruptHandler_) {
         interruptHandler_(*interrupt_);
       }
index 66c3d3fa72e0ae25660a739f8f4b33830a896964..b4139d4207638939b73bea48dd2f7d4ec642b1df 100644 (file)
@@ -29,8 +29,9 @@ TEST(Filter, alwaysFalse) {
 }
 
 TEST(Filter, moveOnlyValue) {
-  EXPECT_EQ(42,
-    *makeFuture(folly::make_unique<int>(42))
-     .filter([](std::unique_ptr<int> const&) { return true; })
-     .get());
+  EXPECT_EQ(
+      42,
+      *makeFuture(std::make_unique<int>(42))
+           .filter([](std::unique_ptr<int> const&) { return true; })
+           .get());
 }
index bad230bcb6644b5d0b466b54a310f16595bd208f..144a924956e8a83d984d1a75606aa2cb75ae4403 100644 (file)
@@ -722,8 +722,8 @@ TEST(Future, detachRace) {
   // slow test so I won't do that but if it ever fails, take it seriously, and
   // run the test binary with "--gtest_repeat=10000 --gtest_filter=*detachRace"
   // (Don't forget to enable ASAN)
-  auto p = folly::make_unique<Promise<bool>>();
-  auto f = folly::make_unique<Future<bool>>(p->getFuture());
+  auto p = std::make_unique<Promise<bool>>();
+  auto f = std::make_unique<Future<bool>>(p->getFuture());
   folly::Baton<> baton;
   std::thread t1([&]{
     baton.post();
@@ -818,7 +818,7 @@ TEST(Future, RequestContext) {
   {
     folly::RequestContextScopeGuard rctx;
     RequestContext::get()->setContextData(
-        "key", folly::make_unique<MyRequestData>(true));
+        "key", std::make_unique<MyRequestData>(true));
     auto checker = [](int lineno) {
       return [lineno](Try<int>&& /* t */) {
         auto d = static_cast<MyRequestData*>(
index f9e6f4bed3455ac328e41aecccb766e73ce017d9..3e36c2cefc6922ba2e7028abd977cf3463c314bf 100644 (file)
@@ -38,7 +38,7 @@ TEST(NonCopyableLambda, basic) {
 
 TEST(NonCopyableLambda, unique_ptr) {
   Promise<Unit> promise;
-  auto int_ptr = folly::make_unique<int>(1);
+  auto int_ptr = std::make_unique<int>(1);
 
   EXPECT_EQ(*int_ptr, 1);
 
index ff9cef9cdc117016de938ecb37796272189e0461..3673dc1d18f9c27fa8c8d12ec0b101f48c528167 100644 (file)
@@ -134,7 +134,7 @@ TEST(Promise, isFulfilledWithFuture) {
 }
 
 TEST(Promise, brokenOnDelete) {
-  auto p = folly::make_unique<Promise<int>>();
+  auto p = std::make_unique<Promise<int>>();
   auto f = p->getFuture();
 
   EXPECT_FALSE(f.isReady());
@@ -149,10 +149,10 @@ TEST(Promise, brokenOnDelete) {
 }
 
 TEST(Promise, brokenPromiseHasTypeInfo) {
-  auto pInt = folly::make_unique<Promise<int>>();
+  auto pInt = std::make_unique<Promise<int>>();
   auto fInt = pInt->getFuture();
 
-  auto pFloat = folly::make_unique<Promise<float>>();
+  auto pFloat = std::make_unique<Promise<float>>();
   auto fFloat = pFloat->getFuture();
 
   pInt.reset();
index 2bdabfc04974cd167dd35af60f03a58704d8d6f5..f843a0299bf7175b1ec61ba2f610a466dd4ef584 100644 (file)
@@ -335,9 +335,8 @@ class ThreadExecutor : public Executor {
 
 TEST(Via, viaThenGetWasRacy) {
   ThreadExecutor x;
-  std::unique_ptr<int> val = folly::via(&x)
-    .then([] { return folly::make_unique<int>(42); })
-    .get();
+  std::unique_ptr<int> val =
+      folly::via(&x).then([] { return std::make_unique<int>(42); }).get();
   ASSERT_TRUE(!!val);
   EXPECT_EQ(42, *val);
 }
@@ -603,7 +602,7 @@ TEST(ViaFunc, isSticky) {
 
 TEST(ViaFunc, moveOnly) {
   ManualExecutor x;
-  auto intp = folly::make_unique<int>(42);
+  auto intp = std::make_unique<int>(42);
 
   EXPECT_EQ(42, via(&x, [intp = std::move(intp)] { return *intp; }).getVia(&x));
 }
index c61b1209fdd5a35c44e9766f0d6a73f92e49c102..999d74b9189f5fcc3467b30444b33a2bd9f5219a 100644 (file)
@@ -1274,14 +1274,14 @@ TEST(Gen, Unwrap) {
   EXPECT_EQ(4, o | unwrap);
   EXPECT_THROW(e | unwrap, OptionalEmptyException);
 
-  auto oup = folly::make_optional(folly::make_unique<int>(5));
+  auto oup = folly::make_optional(std::make_unique<int>(5));
   // optional has a value, and that value is non-null
   EXPECT_TRUE(bool(oup | unwrap));
   EXPECT_EQ(5, *(oup | unwrap));
   EXPECT_TRUE(oup.hasValue()); // still has a pointer (null or not)
   EXPECT_TRUE(bool(oup.value())); // that value isn't null
 
-  auto moved1 = std::move(oup) | unwrapOr(folly::make_unique<int>(6));
+  auto moved1 = std::move(oup) | unwrapOr(std::make_unique<int>(6));
   // oup still has a value, but now it's now nullptr since the pointer was moved
   // into moved1
   EXPECT_TRUE(oup.hasValue());
@@ -1289,12 +1289,12 @@ TEST(Gen, Unwrap) {
   EXPECT_TRUE(bool(moved1));
   EXPECT_EQ(5, *moved1);
 
-  auto moved2 = std::move(oup) | unwrapOr(folly::make_unique<int>(7));
+  auto moved2 = std::move(oup) | unwrapOr(std::make_unique<int>(7));
   // oup's still-valid nullptr value wins here, the pointer to 7 doesn't apply
   EXPECT_FALSE(moved2);
 
   oup.clear();
-  auto moved3 = std::move(oup) | unwrapOr(folly::make_unique<int>(8));
+  auto moved3 = std::move(oup) | unwrapOr(std::make_unique<int>(8));
   // oup is empty now, so the unwrapOr comes into play.
   EXPECT_TRUE(bool(moved3));
   EXPECT_EQ(8, *moved3);
@@ -1332,7 +1332,7 @@ TEST(Gen, Unwrap) {
 
   {
     auto opt = folly::make_optional(std::make_shared<int>(8));
-    auto fallback = unwrapOr(folly::make_unique<int>(9));
+    auto fallback = unwrapOr(std::make_unique<int>(9));
     // fallback must be std::move'd to be used
     EXPECT_EQ(8, *(opt | std::move(fallback)));
     EXPECT_TRUE(bool(opt.value())); // shared_ptr copied out, not moved
index c7c1c357a9518ed6c84cc21789fd7828a55f036f..3791db7dc4efc95593594f45365fd705ac6715a3 100644 (file)
@@ -1338,7 +1338,7 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) {
                << "): client intitiated SSL renegotiation not permitted";
     return ReadResult(
         READ_ERROR,
-        folly::make_unique<SSLException>(SSLError::CLIENT_RENEGOTIATION));
+        std::make_unique<SSLException>(SSLError::CLIENT_RENEGOTIATION));
   }
   if (bytes <= 0) {
     int error = SSL_get_error(ssl_, bytes);
@@ -1358,7 +1358,7 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) {
                  << "): unsupported SSL renegotiation during read";
       return ReadResult(
           READ_ERROR,
-          folly::make_unique<SSLException>(SSLError::INVALID_RENEGOTIATION));
+          std::make_unique<SSLException>(SSLError::INVALID_RENEGOTIATION));
     } else {
       if (zero_return(error, bytes)) {
         return ReadResult(bytes);
@@ -1375,7 +1375,7 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) {
               << "reason: " << ERR_reason_error_string(errError);
       return ReadResult(
           READ_ERROR,
-          folly::make_unique<SSLException>(error, errError, bytes, errno));
+          std::make_unique<SSLException>(error, errError, bytes, errno));
     }
   } else {
     appBytesReceived_ += bytes;
@@ -1418,7 +1418,7 @@ AsyncSocket::WriteResult AsyncSSLSocket::interpretSSLError(int rc, int error) {
                << "unsupported SSL renegotiation during write";
     return WriteResult(
         WRITE_ERROR,
-        folly::make_unique<SSLException>(SSLError::INVALID_RENEGOTIATION));
+        std::make_unique<SSLException>(SSLError::INVALID_RENEGOTIATION));
   } else {
     if (zero_return(error, rc)) {
       return WriteResult(0);
@@ -1431,7 +1431,7 @@ AsyncSocket::WriteResult AsyncSSLSocket::interpretSSLError(int rc, int error) {
             << ", reason: " << ERR_reason_error_string(errError);
     return WriteResult(
         WRITE_ERROR,
-        folly::make_unique<SSLException>(error, errError, rc, errno));
+        std::make_unique<SSLException>(error, errError, rc, errno));
   }
 }
 
@@ -1452,7 +1452,7 @@ AsyncSocket::WriteResult AsyncSSLSocket::performWrite(
                << "TODO: AsyncSSLSocket currently does not support calling "
                << "write() before the handshake has fully completed";
     return WriteResult(
-        WRITE_ERROR, folly::make_unique<SSLException>(SSLError::EARLY_WRITE));
+        WRITE_ERROR, std::make_unique<SSLException>(SSLError::EARLY_WRITE));
   }
 
   // Declare a buffer used to hold small write requests.  It could point to a
index 17040bf9737df7ff04bd1e4908c064834001aa16..dc550a310e61ca9f8fdecaa7b69cdf72b61f0a6d 100644 (file)
@@ -2011,7 +2011,7 @@ AsyncSocket::sendSocketMessage(int fd, struct msghdr* msg, int msg_flags) {
         registerForConnectEvents();
       } catch (const AsyncSocketException& ex) {
         return WriteResult(
-            WRITE_ERROR, folly::make_unique<AsyncSocketException>(ex));
+            WRITE_ERROR, std::make_unique<AsyncSocketException>(ex));
       }
       // Let's fake it that no bytes were written and return an errno.
       errno = EAGAIN;
@@ -2034,7 +2034,7 @@ AsyncSocket::sendSocketMessage(int fd, struct msghdr* msg, int msg_flags) {
         totalWritten = -1;
       } catch (const AsyncSocketException& ex) {
         return WriteResult(
-            WRITE_ERROR, folly::make_unique<AsyncSocketException>(ex));
+            WRITE_ERROR, std::make_unique<AsyncSocketException>(ex));
       }
     } else if (errno == EAGAIN) {
       // Normally sendmsg would indicate that the write would block.
@@ -2043,7 +2043,7 @@ AsyncSocket::sendSocketMessage(int fd, struct msghdr* msg, int msg_flags) {
       // instead, and is an error condition indicating no fds available.
       return WriteResult(
           WRITE_ERROR,
-          folly::make_unique<AsyncSocketException>(
+          std::make_unique<AsyncSocketException>(
               AsyncSocketException::UNKNOWN, "No more free local ports"));
     }
   } else {
index d0d58def06e20e4d5411155b9bff918680612c4d..a485d33254908c9ac546038e124fadce313b467b 100644 (file)
@@ -740,7 +740,7 @@ const char* EventBase::getLibeventMethod() { return event_get_method(); }
 
 VirtualEventBase& EventBase::getVirtualEventBase() {
   folly::call_once(virtualEventBaseInitFlag_, [&] {
-    virtualEventBase_ = folly::make_unique<VirtualEventBase>(*this);
+    virtualEventBase_ = std::make_unique<VirtualEventBase>(*this);
   });
 
   return *virtualEventBase_;
index c464c3fbad2e45206b160b883d9a736ecfe426ff..0fa49cbdb32ac4231689655af5a6f5889ec4cc9a 100644 (file)
@@ -251,7 +251,7 @@ size_t HHWheelTimer::cancelAll() {
   if (count_ != 0) {
     const uint64_t numElements = WHEEL_BUCKETS * WHEEL_SIZE;
     auto maxBuckets = std::min(numElements, count_);
-    auto buckets = folly::make_unique<CallbackList[]>(maxBuckets);
+    auto buckets = std::make_unique<CallbackList[]>(maxBuckets);
     size_t countBuckets = 0;
     for (auto& tick : buckets_) {
       for (auto& bucket : tick) {
index 363db6a2925880c4bc98a48e1dfa84635b4360b1..e1c1dfac9fb37ff258a591bcee24f9ce9ac49818 100644 (file)
@@ -72,7 +72,7 @@ struct TimeoutManager::CobTimeouts {
 };
 
 TimeoutManager::TimeoutManager()
-    : cobTimeouts_(folly::make_unique<CobTimeouts>()) {}
+    : cobTimeouts_(std::make_unique<CobTimeouts>()) {}
 
 void TimeoutManager::runAfterDelay(
     Func cob,
@@ -92,8 +92,8 @@ bool TimeoutManager::tryRunAfterDelay(
     return false;
   }
 
-  auto timeout = folly::make_unique<CobTimeouts::CobTimeout>(
-      this, std::move(cob), internal);
+  auto timeout =
+      std::make_unique<CobTimeouts::CobTimeout>(this, std::move(cob), internal);
   if (!timeout->scheduleTimeout(milliseconds)) {
     return false;
   }
index bc42103dfa5cce97a36fb1e630fbbb9f8016cb88..3874f57890e716bb8b60647d6fdba638e6c999d7 100644 (file)
@@ -181,7 +181,7 @@ TEST(AsyncSSLSocketTest, ReadAfterClose) {
   ReadEOFCallback readCallback(&writeCallback);
   HandshakeCallback handshakeCallback(&readCallback);
   SSLServerAcceptCallback acceptCallback(&handshakeCallback);
-  auto server = folly::make_unique<TestSSLServer>(&acceptCallback);
+  auto server = std::make_unique<TestSSLServer>(&acceptCallback);
 
   // Set up SSL context.
   auto sslContext = std::make_shared<SSLContext>();
@@ -402,8 +402,8 @@ class NextProtocolTest : public testing::TestWithParam<NextProtocolTypePair> {
       new AsyncSSLSocket(clientCtx, &eventBase, fds[0], false));
     AsyncSSLSocket::UniquePtr serverSock(
       new AsyncSSLSocket(serverCtx, &eventBase, fds[1], true));
-    client = folly::make_unique<NpnClient>(std::move(clientSock));
-    server = folly::make_unique<NpnServer>(std::move(serverSock));
+    client = std::make_unique<NpnClient>(std::move(clientSock));
+    server = std::make_unique<NpnServer>(std::move(serverSock));
 
     eventBase.loop();
   }
index e90bca5c728c5788c1038b547118b7abbcf35459..fb68b2a6d47a6c9e968611465a6cbf77c7bf3366 100644 (file)
@@ -2806,7 +2806,7 @@ class MockEvbChangeCallback : public AsyncSocket::EvbChangeCallback {
 };
 
 TEST(AsyncSocketTest, EvbCallbacks) {
-  auto cb = folly::make_unique<MockEvbChangeCallback>();
+  auto cb = std::make_unique<MockEvbChangeCallback>();
   EventBase evb;
   std::shared_ptr<AsyncSocket> socket = AsyncSocket::newSocket(&evb);
 
index 73b68c8440cea228cfd5bbedfad98d66759963f2..ee420257df458641cc4d3e2a9ddcdc6520031c54 100644 (file)
@@ -85,9 +85,7 @@ class UDPServer {
   void start() {
     CHECK(evb_->isInEventBaseThread());
 
-    socket_ = folly::make_unique<AsyncUDPServerSocket>(
-        evb_,
-        1500);
+    socket_ = std::make_unique<AsyncUDPServerSocket>(evb_, 1500);
 
     try {
       socket_->bind(addr_);
@@ -159,7 +157,7 @@ class UDPClient
     CHECK(evb_->isInEventBaseThread());
 
     server_ = server;
-    socket_ = folly::make_unique<AsyncUDPSocket>(evb_);
+    socket_ = std::make_unique<AsyncUDPSocket>(evb_);
 
     try {
       socket_->bind(folly::SocketAddress("127.0.0.1", 0));
index ae455c7eb613ecb63a506a4dfbe5b049131a3c01..ce1c6c770d3f279dd351fc477f72a3c90ff95cf3 100644 (file)
@@ -1789,7 +1789,7 @@ TEST(EventBaseTest, LoopKeepAliveInLoop) {
 }
 
 TEST(EventBaseTest, LoopKeepAliveWithLoopForever) {
-  std::unique_ptr<EventBase> evb = folly::make_unique<EventBase>();
+  std::unique_ptr<EventBase> evb = std::make_unique<EventBase>();
 
   bool done = false;
 
@@ -1817,7 +1817,7 @@ TEST(EventBaseTest, LoopKeepAliveWithLoopForever) {
 }
 
 TEST(EventBaseTest, LoopKeepAliveShutdown) {
-  auto evb = folly::make_unique<EventBase>();
+  auto evb = std::make_unique<EventBase>();
 
   bool done = false;
 
@@ -1840,7 +1840,7 @@ TEST(EventBaseTest, LoopKeepAliveShutdown) {
 }
 
 TEST(EventBaseTest, LoopKeepAliveAtomic) {
-  auto evb = folly::make_unique<EventBase>();
+  auto evb = std::make_unique<EventBase>();
 
   static constexpr size_t kNumThreads = 100;
   static constexpr size_t kNumTasks = 100;
@@ -1850,7 +1850,7 @@ TEST(EventBaseTest, LoopKeepAliveAtomic) {
   size_t done{0};
 
   for (size_t i = 0; i < kNumThreads; ++i) {
-    batons.emplace_back(folly::make_unique<Baton<>>());
+    batons.emplace_back(std::make_unique<Baton<>>());
   }
 
   for (size_t i = 0; i < kNumThreads; ++i) {
index ac24c5b5e6ca55da8146e0bd7c9de2ca618578d5..4b73d2c2fc2593c9420c8cdee3852640a88733d5 100644 (file)
@@ -56,8 +56,7 @@ TEST(RequestContext, SimpleTest) {
 
   EXPECT_EQ(nullptr, RequestContext::get()->getContextData("test"));
 
-  RequestContext::get()->setContextData(
-      "test", folly::make_unique<TestData>(10));
+  RequestContext::get()->setContextData("test", std::make_unique<TestData>(10));
   base.runInEventBaseThread([&](){
       EXPECT_TRUE(RequestContext::get() != nullptr);
       auto data = dynamic_cast<TestData*>(
@@ -83,16 +82,15 @@ TEST(RequestContext, SimpleTest) {
 TEST(RequestContext, setIfAbsentTest) {
   EXPECT_TRUE(RequestContext::get() != nullptr);
 
-  RequestContext::get()->setContextData(
-      "test", folly::make_unique<TestData>(10));
+  RequestContext::get()->setContextData("test", std::make_unique<TestData>(10));
   EXPECT_FALSE(RequestContext::get()->setContextDataIfAbsent(
-      "test", folly::make_unique<TestData>(20)));
+      "test", std::make_unique<TestData>(20)));
   EXPECT_EQ(10,
             dynamic_cast<TestData*>(
                 RequestContext::get()->getContextData("test"))->data_);
 
   EXPECT_TRUE(RequestContext::get()->setContextDataIfAbsent(
-      "test2", folly::make_unique<TestData>(20)));
+      "test2", std::make_unique<TestData>(20)));
   EXPECT_EQ(20,
             dynamic_cast<TestData*>(
                 RequestContext::get()->getContextData("test2"))->data_);
@@ -104,13 +102,13 @@ TEST(RequestContext, setIfAbsentTest) {
 TEST(RequestContext, testSetUnset) {
   RequestContext::create();
   auto ctx1 = RequestContext::saveContext();
-  ctx1->setContextData("test", folly::make_unique<TestData>(10));
+  ctx1->setContextData("test", std::make_unique<TestData>(10));
   auto testData1 = dynamic_cast<TestData*>(ctx1->getContextData("test"));
 
   // Override RequestContext
   RequestContext::create();
   auto ctx2 = RequestContext::saveContext();
-  ctx2->setContextData("test", folly::make_unique<TestData>(20));
+  ctx2->setContextData("test", std::make_unique<TestData>(20));
   auto testData2 = dynamic_cast<TestData*>(ctx2->getContextData("test"));
 
   // Check ctx1->onUnset was called
@@ -137,7 +135,7 @@ TEST(RequestContext, deadlockTest) {
 
     virtual ~DeadlockTestData() {
       RequestContext::get()->setContextData(
-          val_, folly::make_unique<TestData>(1));
+          val_, std::make_unique<TestData>(1));
     }
 
     void onSet() override {}
@@ -148,6 +146,6 @@ TEST(RequestContext, deadlockTest) {
   };
 
   RequestContext::get()->setContextData(
-      "test", folly::make_unique<DeadlockTestData>("test2"));
+      "test", std::make_unique<DeadlockTestData>("test2"));
   RequestContext::get()->clearContextData("test");
 }
index 77ab567f3c771524edb4448a9eac444a480212c3..a85f7937253440bcdd23c57c7c42361f4485b0cf 100644 (file)
@@ -138,7 +138,7 @@ TEST_F(SSLSessionTest, SerializeDeserializeTest) {
     ASSERT_TRUE(client.handshakeSuccess_);
 
     std::unique_ptr<SSLSession> sess =
-        folly::make_unique<SSLSession>(clientPtr->getSSLSession());
+        std::make_unique<SSLSession>(clientPtr->getSSLSession());
     sessiondata = sess->serialize();
     ASSERT_TRUE(!sessiondata.empty());
   }
@@ -150,7 +150,7 @@ TEST_F(SSLSessionTest, SerializeDeserializeTest) {
         new AsyncSSLSocket(clientCtx, &eventBase, fds[0], serverName));
     auto clientPtr = clientSock.get();
     std::unique_ptr<SSLSession> sess =
-        folly::make_unique<SSLSession>(sessiondata);
+        std::make_unique<SSLSession>(sessiondata);
     ASSERT_NE(sess.get(), nullptr);
     clientSock->setSSLSession(sess->getRawSSLSessionDangerous(), true);
     AsyncSSLSocket::UniquePtr serverSock(
@@ -181,7 +181,7 @@ TEST_F(SSLSessionTest, GetSessionID) {
   ASSERT_TRUE(client.handshakeSuccess_);
 
   std::unique_ptr<SSLSession> sess =
-      folly::make_unique<SSLSession>(clientPtr->getSSLSession());
+      std::make_unique<SSLSession>(clientPtr->getSSLSession());
   ASSERT_NE(sess, nullptr);
   auto sessID = sess->getSessionID();
   ASSERT_GE(sessID.length(), 0);
index 9db7e54e183382cba6b2b9328d4cb5f30c08f52d..e7aefb488fc7a506493f03607d5aa6f29623f9c7 100644 (file)
@@ -23,7 +23,7 @@
 namespace folly {
 
 ScopedBoundPort::ScopedBoundPort(IPAddress host) {
-  ebth_ = folly::make_unique<ScopedEventBaseThread>();
+  ebth_ = std::make_unique<ScopedEventBaseThread>();
   ebth_->getEventBase()->runInEventBaseThreadAndWait([&] {
     sock_ = AsyncServerSocket::newSocket(ebth_->getEventBase());
     sock_->bind(SocketAddress(host, 0));
index 8e7a7d351dedac91ecbc69b08e80d5b4191aa016..c08b8fb99a88eb54516a8df16871aa8880303478 100644 (file)
@@ -27,13 +27,12 @@ class SSLSession {
  public:
   // Holds and takes ownership of an SSL_SESSION object by incrementing refcount
   explicit SSLSession(SSL_SESSION* session, bool takeOwnership = true)
-      : impl_(folly::make_unique<detail::SSLSessionImpl>(
-            session,
-            takeOwnership)) {}
+      : impl_(
+            std::make_unique<detail::SSLSessionImpl>(session, takeOwnership)) {}
 
   // Deserialize from a string
   explicit SSLSession(const std::string& serializedSession)
-      : impl_(folly::make_unique<detail::SSLSessionImpl>(serializedSession)) {}
+      : impl_(std::make_unique<detail::SSLSessionImpl>(serializedSession)) {}
 
   // Serialize to a string that is suitable to store in a persistent cache
   std::string serialize() const {
index 6290eab719430d294f5de81417692e7879af6cc5..f580a67f15f981ba0caa38279a315f17267a2fc1 100644 (file)
@@ -33,7 +33,7 @@ struct MyObject {
 typedef folly::AtomicHashMap<int,std::shared_ptr<MyObject>> MyMap;
 typedef std::lock_guard<std::mutex> Guard;
 
-std::unique_ptr<MyMap> newMap() { return folly::make_unique<MyMap>(100); }
+std::unique_ptr<MyMap> newMap() { return std::make_unique<MyMap>(100); }
 
 struct MyObjectDirectory {
   MyObjectDirectory()
index 546fb6f4f2a95129f9f4b9cc42223fb4103f2fbd..042b36682d30dadc140e8475c0f3ee6626f7c241 100644 (file)
@@ -313,7 +313,7 @@ TEST(Function, Bind) {
 // NonCopyableLambda
 
 TEST(Function, NonCopyableLambda) {
-  auto unique_ptr_int = folly::make_unique<int>(900);
+  auto unique_ptr_int = std::make_unique<int>(900);
   EXPECT_EQ(900, *unique_ptr_int);
 
   struct {
index 9269b890dff2a70f9ce0c699215fb2bddfe799ab..f556ebbf326d9442822abd153d52e23be0d5da97 100644 (file)
@@ -149,7 +149,7 @@ TEST(MPMCQueue, lots_of_element_types) {
   runElementTypeTest(std::make_pair(10, string("def")));
   runElementTypeTest(vector<string>{{"abc"}});
   runElementTypeTest(std::make_shared<char>('a'));
-  runElementTypeTest(folly::make_unique<char>('a'));
+  runElementTypeTest(std::make_unique<char>('a'));
   runElementTypeTest(boost::intrusive_ptr<RefCounted>(new RefCounted));
   EXPECT_EQ(RefCounted::active_instances, 0);
 }
@@ -160,7 +160,7 @@ TEST(MPMCQueue, lots_of_element_types_dynamic) {
   runElementTypeTest<true>(std::make_pair(10, string("def")));
   runElementTypeTest<true>(vector<string>{{"abc"}});
   runElementTypeTest<true>(std::make_shared<char>('a'));
-  runElementTypeTest<true>(folly::make_unique<char>('a'));
+  runElementTypeTest<true>(std::make_unique<char>('a'));
   runElementTypeTest<true>(boost::intrusive_ptr<RefCounted>(new RefCounted));
   EXPECT_EQ(RefCounted::active_instances, 0);
 }
index c33549d0cb253856517076ae59726d1f8facaf12..392a52fc93cb3a036c57e156db52db2f8df8a40f 100644 (file)
@@ -103,7 +103,7 @@ TEST(ThreadLocalPtr, DefaultDeleterOwnershipTransfer) {
   Widget::totalVal_ = 0;
   {
     ThreadLocalPtr<Widget> w;
-    auto source = folly::make_unique<Widget>();
+    auto source = std::make_unique<Widget>();
     std::thread([&w, &source]() {
       w.reset(std::move(source));
       w.get()->val_ += 10;
index 932b7e9664f974d1cde1c8438b1d365daf782416..c986f40d471cbe74ffd485db74ddc68987de2b19 100644 (file)
@@ -55,7 +55,7 @@ TEST(Try, moveOnly) {
 
 TEST(Try, makeTryWith) {
   auto func = []() {
-    return folly::make_unique<int>(1);
+    return std::make_unique<int>(1);
   };
 
   auto result = makeTryWith(func);