1 // 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 "quiche/quic/core/quic_alarm_factory.h" 9 #include "quiche/quic/test_tools/simulator/actor.h" 10 11 namespace quic { 12 namespace simulator { 13 14 // AlarmFactory allows to schedule QuicAlarms using the simulation event queue. 15 class AlarmFactory : public QuicAlarmFactory { 16 public: 17 AlarmFactory(Simulator* simulator, std::string name); 18 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. 29 std::string GetNewAlarmName(); 30 31 Simulator* simulator_; 32 std::string name_; 33 int counter_; 34 }; 35 36 } // namespace simulator 37 } // namespace quic 38 39 #endif // QUICHE_QUIC_TEST_TOOLS_SIMULATOR_ALARM_FACTORY_H_ 40