blob: d765175e18be061819ec0f807a5450876ba6d91d [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef QUICHE_QUIC_TEST_TOOLS_SIMULATOR_ALARM_FACTORY_H_
6#define QUICHE_QUIC_TEST_TOOLS_SIMULATOR_ALARM_FACTORY_H_
7
8#include "net/third_party/quiche/src/quic/core/quic_alarm_factory.h"
9#include "net/third_party/quiche/src/quic/test_tools/simulator/actor.h"
10
11namespace quic {
12namespace simulator {
13
14// AlarmFactory allows to schedule QuicAlarms using the simulation event queue.
15class AlarmFactory : public QuicAlarmFactory {
16 public:
vasilvvc48c8712019-03-11 13:38:16 -070017 AlarmFactory(Simulator* simulator, std::string name);
QUICHE teama6ef0a62019-03-07 20:34:33 -050018 AlarmFactory(const AlarmFactory&) = delete;
19 AlarmFactory& operator=(const AlarmFactory&) = delete;
20 ~AlarmFactory() override;
21
22 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override;
23 QuicArenaScopedPtr<QuicAlarm> CreateAlarm(
24 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate,
25 QuicConnectionArena* arena) override;
26
27 private:
28 // Automatically generate a name for a new alarm.
vasilvvc48c8712019-03-11 13:38:16 -070029 std::string GetNewAlarmName();
QUICHE teama6ef0a62019-03-07 20:34:33 -050030
31 Simulator* simulator_;
vasilvvc48c8712019-03-11 13:38:16 -070032 std::string name_;
QUICHE teama6ef0a62019-03-07 20:34:33 -050033 int counter_;
34};
35
36} // namespace simulator
37} // namespace quic
38
39#endif // QUICHE_QUIC_TEST_TOOLS_SIMULATOR_ALARM_FACTORY_H_