From: Chad Parry Date: Thu, 12 Nov 2015 00:02:35 +0000 (-0800) Subject: Restore the definition of HHWheelTimer::UniquePtr X-Git-Tag: deprecate-dynamic-initializer~259 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=65b8a0205fd9bbceb3e766962046651a6ddeb335;p=folly.git Restore the definition of HHWheelTimer::UniquePtr Summary: Changing the definition of `HHWheelTimer::UniquePtr` wasn't safe, because some clients were using that type outside of the `HHWheelTimer::newTimer` helper. I'm changing that part back. We'll still be able to proceed with my other codemod to `HHWheelTimer`, but we'll always have two different smart pointer types to manage: `UniquePtr` and `IntrusivePtr`. Reviewed By: djwatson Differential Revision: D2644721 fb-gh-sync-id: 14685be62355f09d39c4139ef7186d60b5f48dcd --- diff --git a/folly/io/async/HHWheelTimer.h b/folly/io/async/HHWheelTimer.h index 17a74d54..e8e678da 100644 --- a/folly/io/async/HHWheelTimer.h +++ b/folly/io/async/HHWheelTimer.h @@ -60,15 +60,12 @@ class HHWheelTimer : private folly::AsyncTimeout, public folly::DelayedDestruction { public: // This type has always been a misnomer, because it is not a unique pointer. - using UniquePtr = IntrusivePtr; + using UniquePtr = std::unique_ptr; + using SharedPtr = IntrusivePtr; template static UniquePtr newTimer(Args&&... args) { - std::unique_ptr instance( - new HHWheelTimer(std::forward(args)...)); - // Avoid the weird semantics of the Destructor by managing ownership - // entirely from the IntrusivePtr. - return UniquePtr(instance); + return UniquePtr(new HHWheelTimer(std::forward(args)...)); } /**