Make HHWheelTimer take a TimeoutManager rather than EventBase
authorAlan Frindell <afrind@fb.com>
Tue, 2 Feb 2016 23:31:32 +0000 (15:31 -0800)
committerfacebook-github-bot-1 <folly-bot@fb.com>
Wed, 3 Feb 2016 00:20:42 +0000 (16:20 -0800)
Summary: TimeoutManager is a Mockable parent class

Reviewed By: maxgeorg

Differential Revision: D2892671

fb-gh-sync-id: d20635b18a7c748009ce4880c80a13ac23b9222a

folly/io/async/HHWheelTimer.cpp
folly/io/async/HHWheelTimer.h

index cd9f5c7ed28b39ab644d10b341017ddca6bb5736..e104ca6fe3e3976a2a64e420b2c7a7a966b4203f 100644 (file)
@@ -78,20 +78,18 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() {
   expiration_ = milliseconds(0);
 }
 
   expiration_ = milliseconds(0);
 }
 
-HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase,
+HHWheelTimer::HHWheelTimer(folly::TimeoutManager* timeoutMananger,
                            std::chrono::milliseconds intervalMS,
                            AsyncTimeout::InternalEnum internal,
                            std::chrono::milliseconds defaultTimeoutMS)
                            std::chrono::milliseconds intervalMS,
                            AsyncTimeout::InternalEnum internal,
                            std::chrono::milliseconds defaultTimeoutMS)
-  : AsyncTimeout(eventBase, internal)
-  , interval_(intervalMS)
-  , defaultTimeout_(defaultTimeoutMS)
-  , nextTick_(1)
-  , count_(0)
-  , catchupEveryN_(DEFAULT_CATCHUP_EVERY_N)
-  , expirationsSinceCatchup_(0)
-  , processingCallbacksGuard_(false)
-{
-}
+    : AsyncTimeout(timeoutMananger, internal),
+      interval_(intervalMS),
+      defaultTimeout_(defaultTimeoutMS),
+      nextTick_(1),
+      count_(0),
+      catchupEveryN_(DEFAULT_CATCHUP_EVERY_N),
+      expirationsSinceCatchup_(0),
+      processingCallbacksGuard_(false) {}
 
 HHWheelTimer::~HHWheelTimer() {
   CHECK(count_ == 0);
 
 HHWheelTimer::~HHWheelTimer() {
   CHECK(count_ == 0);
index e8e678da0f16d3e783527ab2ffc9d4cca9f3ac77..70dbcc60d6c7dddfb34480a7ca34fb09a4a15330 100644 (file)
@@ -166,13 +166,13 @@ class HHWheelTimer : private folly::AsyncTimeout,
    * interval timeouts using scheduleTimeout(callback) method.
    */
   static int DEFAULT_TICK_INTERVAL;
    * interval timeouts using scheduleTimeout(callback) method.
    */
   static int DEFAULT_TICK_INTERVAL;
-  explicit HHWheelTimer(folly::EventBase* eventBase,
-                        std::chrono::milliseconds intervalMS =
-                        std::chrono::milliseconds(DEFAULT_TICK_INTERVAL),
-                        AsyncTimeout::InternalEnum internal =
-                        AsyncTimeout::InternalEnum::NORMAL,
-                        std::chrono::milliseconds defaultTimeoutMS =
-                        std::chrono::milliseconds(-1));
+  explicit HHWheelTimer(
+      folly::TimeoutManager* timeoutManager,
+      std::chrono::milliseconds intervalMS =
+          std::chrono::milliseconds(DEFAULT_TICK_INTERVAL),
+      AsyncTimeout::InternalEnum internal = AsyncTimeout::InternalEnum::NORMAL,
+      std::chrono::milliseconds defaultTimeoutMS =
+          std::chrono::milliseconds(-1));
 
   /**
    * Destroy the HHWheelTimer.
 
   /**
    * Destroy the HHWheelTimer.