1 // Copyright (c) 2015 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_CORE_QUIC_ALARM_FACTORY_H_ 6 #define QUICHE_QUIC_CORE_QUIC_ALARM_FACTORY_H_ 7 8 #include "quiche/quic/core/quic_alarm.h" 9 #include "quiche/quic/core/quic_one_block_arena.h" 10 #include "quiche/quic/platform/api/quic_export.h" 11 12 namespace quic { 13 14 // Creates platform-specific alarms used throughout QUIC. 15 class QUICHE_EXPORT QuicAlarmFactory { 16 public: ~QuicAlarmFactory()17 virtual ~QuicAlarmFactory() {} 18 19 // Creates a new platform-specific alarm which will be configured to notify 20 // |delegate| when the alarm fires. Returns an alarm allocated on the heap. 21 // Caller takes ownership of the new alarm, which will not yet be "set" to 22 // fire. 23 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0; 24 25 // Creates a new platform-specific alarm which will be configured to notify 26 // |delegate| when the alarm fires. Caller takes ownership of the new alarm, 27 // which will not yet be "set" to fire. If |arena| is null, then the alarm 28 // will be created on the heap. Otherwise, it will be created in |arena|. 29 virtual QuicArenaScopedPtr<QuicAlarm> CreateAlarm( 30 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, 31 QuicConnectionArena* arena) = 0; 32 }; 33 34 } // namespace quic 35 36 #endif // QUICHE_QUIC_CORE_QUIC_ALARM_FACTORY_H_ 37