1 // Copyright 2022 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 #include "quiche/quic/core/io/quic_default_event_loop.h" 6 7 #include <memory> 8 9 #include "quiche/quic/core/io/quic_poll_event_loop.h" 10 #include "quiche/common/platform/api/quiche_event_loop.h" 11 12 #ifdef QUICHE_ENABLE_LIBEVENT 13 #include "quiche/quic/bindings/quic_libevent.h" 14 #endif 15 16 namespace quic { 17 GetDefaultEventLoop()18QuicEventLoopFactory* GetDefaultEventLoop() { 19 if (QuicEventLoopFactory* factory = 20 quiche::GetOverrideForDefaultEventLoop()) { 21 return factory; 22 } 23 #ifdef QUICHE_ENABLE_LIBEVENT 24 return QuicLibeventEventLoopFactory::Get(); 25 #else 26 return QuicPollEventLoopFactory::Get(); 27 #endif 28 } 29 GetAllSupportedEventLoops()30std::vector<QuicEventLoopFactory*> GetAllSupportedEventLoops() { 31 std::vector<QuicEventLoopFactory*> loops = { 32 #ifdef QUICHE_ENABLE_LIBEVENT 33 QuicLibeventEventLoopFactory::Get(), 34 QuicLibeventEventLoopFactory::GetLevelTriggeredBackendForTests(), 35 #endif 36 QuicPollEventLoopFactory::Get()}; 37 std::vector<QuicEventLoopFactory*> extra = 38 quiche::GetExtraEventLoopImplementations(); 39 loops.insert(loops.end(), extra.begin(), extra.end()); 40 return loops; 41 } 42 43 } // namespace quic 44