Commit 65b8a020 authored by Chad Parry's avatar Chad Parry Committed by facebook-github-bot-1

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
parent 2cf78a6a
...@@ -60,15 +60,12 @@ class HHWheelTimer : private folly::AsyncTimeout, ...@@ -60,15 +60,12 @@ class HHWheelTimer : private folly::AsyncTimeout,
public folly::DelayedDestruction { public folly::DelayedDestruction {
public: public:
// This type has always been a misnomer, because it is not a unique pointer. // This type has always been a misnomer, because it is not a unique pointer.
using UniquePtr = IntrusivePtr<HHWheelTimer>; using UniquePtr = std::unique_ptr<HHWheelTimer, Destructor>;
using SharedPtr = IntrusivePtr<HHWheelTimer>;
template <typename... Args> template <typename... Args>
static UniquePtr newTimer(Args&&... args) { static UniquePtr newTimer(Args&&... args) {
std::unique_ptr<HHWheelTimer, Destructor> instance( return UniquePtr(new HHWheelTimer(std::forward<Args>(args)...));
new HHWheelTimer(std::forward<Args>(args)...));
// Avoid the weird semantics of the Destructor by managing ownership
// entirely from the IntrusivePtr.
return UniquePtr(instance);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment