Commit c3d672e3 authored by Alan Frindell's avatar Alan Frindell Committed by facebook-github-bot-1

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
parent c87fa8d6
...@@ -78,20 +78,18 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() { ...@@ -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, std::chrono::milliseconds intervalMS,
AsyncTimeout::InternalEnum internal, AsyncTimeout::InternalEnum internal,
std::chrono::milliseconds defaultTimeoutMS) std::chrono::milliseconds defaultTimeoutMS)
: AsyncTimeout(eventBase, internal) : AsyncTimeout(timeoutMananger, internal),
, interval_(intervalMS) interval_(intervalMS),
, defaultTimeout_(defaultTimeoutMS) defaultTimeout_(defaultTimeoutMS),
, nextTick_(1) nextTick_(1),
, count_(0) count_(0),
, catchupEveryN_(DEFAULT_CATCHUP_EVERY_N) catchupEveryN_(DEFAULT_CATCHUP_EVERY_N),
, expirationsSinceCatchup_(0) expirationsSinceCatchup_(0),
, processingCallbacksGuard_(false) processingCallbacksGuard_(false) {}
{
}
HHWheelTimer::~HHWheelTimer() { HHWheelTimer::~HHWheelTimer() {
CHECK(count_ == 0); CHECK(count_ == 0);
......
...@@ -166,13 +166,13 @@ class HHWheelTimer : private folly::AsyncTimeout, ...@@ -166,13 +166,13 @@ class HHWheelTimer : private folly::AsyncTimeout,
* interval timeouts using scheduleTimeout(callback) method. * interval timeouts using scheduleTimeout(callback) method.
*/ */
static int DEFAULT_TICK_INTERVAL; static int DEFAULT_TICK_INTERVAL;
explicit HHWheelTimer(folly::EventBase* eventBase, explicit HHWheelTimer(
std::chrono::milliseconds intervalMS = folly::TimeoutManager* timeoutManager,
std::chrono::milliseconds(DEFAULT_TICK_INTERVAL), std::chrono::milliseconds intervalMS =
AsyncTimeout::InternalEnum internal = std::chrono::milliseconds(DEFAULT_TICK_INTERVAL),
AsyncTimeout::InternalEnum::NORMAL, AsyncTimeout::InternalEnum internal = AsyncTimeout::InternalEnum::NORMAL,
std::chrono::milliseconds defaultTimeoutMS = std::chrono::milliseconds defaultTimeoutMS =
std::chrono::milliseconds(-1)); std::chrono::milliseconds(-1));
/** /**
* Destroy the HHWheelTimer. * Destroy the HHWheelTimer.
......
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