OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 NET_QUIC_QUIC_ALARM_FACTORY_H_ |
| 6 #define NET_QUIC_QUIC_ALARM_FACTORY_H_ |
| 7 |
| 8 #include "net/quic/quic_alarm.h" |
| 9 #include "net/quic/quic_one_block_arena.h" |
| 10 |
| 11 namespace net { |
| 12 |
| 13 // QuicConnections currently use around 1KB of polymorphic types which would |
| 14 // ordinarily be on the heap. Instead, store them inline in an arena. |
| 15 using QuicConnectionArena = QuicOneBlockArena<1024>; |
| 16 |
| 17 // Creates platform-specific alarms used throughout QUIC. |
| 18 class QuicAlarmFactory { |
| 19 public: |
| 20 virtual ~QuicAlarmFactory() {} |
| 21 |
| 22 // Creates a new platform-specific alarm which will be configured to notify |
| 23 // |delegate| when the alarm fires. Returns an alarm allocated on the heap. |
| 24 // Caller takes ownership of the new alarm, which will not yet be "set" to |
| 25 // fire. |
| 26 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0; |
| 27 |
| 28 // Creates a new platform-specific alarm which will be configured to notify |
| 29 // |delegate| when the alarm fires. Caller takes ownership of the new alarm, |
| 30 // which will not yet be "set" to fire. If |arena| is null, then the alarm |
| 31 // will be created on the heap. Otherwise, it will be created in |arena|. |
| 32 virtual QuicArenaScopedPtr<QuicAlarm> CreateAlarm( |
| 33 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, |
| 34 QuicConnectionArena* arena) = 0; |
| 35 }; |
| 36 |
| 37 } // namespace net |
| 38 |
| 39 #endif // NET_QUIC_QUIC_ALARM_FACTORY_H_ |
OLD | NEW |