From c3d672e3e3307061abd69528eb26810660e69987 Mon Sep 17 00:00:00 2001 From: Alan Frindell Date: Tue, 2 Feb 2016 15:31:32 -0800 Subject: [PATCH] Make HHWheelTimer take a TimeoutManager rather than EventBase Summary: TimeoutManager is a Mockable parent class Reviewed By: maxgeorg Differential Revision: D2892671 fb-gh-sync-id: d20635b18a7c748009ce4880c80a13ac23b9222a --- folly/io/async/HHWheelTimer.cpp | 20 +++++++++----------- folly/io/async/HHWheelTimer.h | 14 +++++++------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/folly/io/async/HHWheelTimer.cpp b/folly/io/async/HHWheelTimer.cpp index cd9f5c7e..e104ca6f 100644 --- a/folly/io/async/HHWheelTimer.cpp +++ b/folly/io/async/HHWheelTimer.cpp @@ -78,20 +78,18 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() { expiration_ = milliseconds(0); } -HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase, +HHWheelTimer::HHWheelTimer(folly::TimeoutManager* timeoutMananger, 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); diff --git a/folly/io/async/HHWheelTimer.h b/folly/io/async/HHWheelTimer.h index e8e678da..70dbcc60 100644 --- a/folly/io/async/HHWheelTimer.h +++ b/folly/io/async/HHWheelTimer.h @@ -166,13 +166,13 @@ class HHWheelTimer : private folly::AsyncTimeout, * 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. -- 2.34.1