Chromium Code Reviews| Index: net/quic/quic_alarm_factory.h |
| diff --git a/net/quic/quic_alarm_factory.h b/net/quic/quic_alarm_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b251484782246bffeb5d64d9d4d7f15f26f48615 |
| --- /dev/null |
| +++ b/net/quic/quic_alarm_factory.h |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_QUIC_QUIC_ALARM_FACTORY_H_ |
| +#define NET_QUIC_QUIC_ALARM_FACTORY_H_ |
| + |
| +#include "net/quic/quic_alarm.h" |
| +#include "net/quic/quic_one_block_arena.h" |
| + |
| +namespace net { |
| + |
| +// QuicConnections currently use around 1KB of polymorphic types which would |
| +// ordinarily be on the heap. Instead, store them inline in an arena. |
| +using QuicConnectionArena = QuicOneBlockArena<1024>; |
| + |
| +// Creates platform-specific alarms used throughout QUIC. |
| +class QuicAlarmFactory { |
| + public: |
| + virtual ~QuicAlarmFactory() {} |
| + |
| + // Creates a new platform-specific alarm which will be configured to notify |
| + // |delegate| when the alarm fires. Returns an alarm allocated on the heap. |
| + // Caller takes ownership of the new alarm, which will not yet be "set" to |
| + // fire. |
| + virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0; |
| + |
| + // Creates a new platform-specific alarm which will be configured to notify |
| + // |delegate| when the alarm fires. Caller takes ownership of the new alarm, |
| + // which will not yet be "set" to fire. If |arena| is null, then the alarm |
| + // will be created on the heap. Otherwise, it will be created in |arena|. |
| + virtual QuicArenaScopedPtr<QuicAlarm> CreateAlarm( |
| + QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, |
|
Ryan Hamilton
2016/04/18 22:10:54
not your responsibility, but we should consider re
|
| + QuicConnectionArena* arena) = 0; |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_QUIC_QUIC_ALARM_FACTORY_H_ |