relnote: QuicAlarms are now allocated out of an arena in QuicConnection. Guarded by quic_enable_arena_allocation. Enabled by default.
This results in around a 2% improvement in CPU usage, which mostly comes
from reducing the number of stalls whenever an alarm fires.
Enabled by default because otherwise, QuicConnections use extra memory
that they never use.
Merge internal change: 111441965
Fix a static_assert in quic_arena_scoped_ptr. No runtime or functional change.
Merge internal change: 111881552
relnote: n/a. Apply language fixes to QuicArenaScopedPtr/QuicOneBlockArena to allow them to build in Chromium. Not flag protected.
Merge internal change: 112057527
Review URL: https://codereview.chromium.org/1572353002
Cr-Commit-Position: refs/heads/master@{#370803}
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index a2ba09f..7fd347fd 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -194,7 +194,19 @@
}
QuicAlarm* MockConnectionHelper::CreateAlarm(QuicAlarm::Delegate* delegate) {
- return new MockConnectionHelper::TestAlarm(delegate);
+ return new MockConnectionHelper::TestAlarm(
+ QuicArenaScopedPtr<QuicAlarm::Delegate>(delegate));
+}
+
+QuicArenaScopedPtr<QuicAlarm> MockConnectionHelper::CreateAlarm(
+ QuicArenaScopedPtr<QuicAlarm::Delegate> delegate,
+ QuicConnectionArena* arena) {
+ if (arena != nullptr) {
+ return arena->New<MockConnectionHelper::TestAlarm>(std::move(delegate));
+ } else {
+ return QuicArenaScopedPtr<MockConnectionHelper::TestAlarm>(
+ new TestAlarm(std::move(delegate)));
+ }
}
QuicBufferAllocator* MockConnectionHelper::GetBufferAllocator() {