| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // The Google-specific helper for QuicConnection which uses | 5 // The Google-specific helper for QuicConnection which uses |
| 6 // EpollAlarm for alarms, and used an int fd_ for writing data. | 6 // EpollAlarm for alarms, and used an int fd_ for writing data. |
| 7 | 7 |
| 8 #ifndef NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ |
| 9 #define NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ | 9 #define NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ |
| 10 | 10 |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 #include <set> | 12 #include <set> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "net/quic/quic_connection.h" | 15 #include "net/quic/quic_connection.h" |
| 16 #include "net/quic/quic_packet_writer.h" | 16 #include "net/quic/quic_packet_writer.h" |
| 17 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
| 18 #include "net/quic/quic_simple_buffer_allocator.h" | 18 #include "net/quic/quic_simple_buffer_allocator.h" |
| 19 #include "net/quic/quic_time.h" | 19 #include "net/quic/quic_time.h" |
| 20 #include "net/tools/quic/quic_default_packet_writer.h" | 20 #include "net/tools/quic/quic_default_packet_writer.h" |
| 21 #include "net/tools/quic/quic_epoll_clock.h" | 21 #include "net/tools/quic/quic_epoll_clock.h" |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class EpollServer; | 25 class EpollServer; |
| 26 class QuicRandom; | 26 class QuicRandom; |
| 27 | 27 |
| 28 | |
| 29 class AckAlarm; | |
| 30 class RetransmissionAlarm; | |
| 31 class SendAlarm; | |
| 32 class TimeoutAlarm; | |
| 33 | |
| 34 using QuicStreamBufferAllocator = SimpleBufferAllocator; | 28 using QuicStreamBufferAllocator = SimpleBufferAllocator; |
| 35 | 29 |
| 36 enum class QuicAllocator { SIMPLE, BUFFER_POOL }; | 30 enum class QuicAllocator { SIMPLE, BUFFER_POOL }; |
| 37 | 31 |
| 38 class QuicEpollConnectionHelper : public QuicConnectionHelperInterface { | 32 class QuicEpollConnectionHelper : public QuicConnectionHelperInterface { |
| 39 public: | 33 public: |
| 40 QuicEpollConnectionHelper(EpollServer* eps, QuicAllocator allocator); | 34 QuicEpollConnectionHelper(EpollServer* eps, QuicAllocator allocator); |
| 41 ~QuicEpollConnectionHelper() override; | 35 ~QuicEpollConnectionHelper() override; |
| 42 | 36 |
| 43 // QuicEpollConnectionHelperInterface | 37 // QuicEpollConnectionHelperInterface |
| 44 const QuicClock* GetClock() const override; | 38 const QuicClock* GetClock() const override; |
| 45 QuicRandom* GetRandomGenerator() override; | 39 QuicRandom* GetRandomGenerator() override; |
| 46 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; | |
| 47 QuicArenaScopedPtr<QuicAlarm> CreateAlarm( | |
| 48 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, | |
| 49 QuicConnectionArena* arena) override; | |
| 50 | 40 |
| 51 QuicBufferAllocator* GetBufferAllocator() override; | 41 QuicBufferAllocator* GetBufferAllocator() override; |
| 52 | 42 |
| 53 EpollServer* epoll_server() { return epoll_server_; } | |
| 54 | |
| 55 private: | 43 private: |
| 56 friend class QuicConnectionPeer; | 44 friend class QuicConnectionPeer; |
| 57 | 45 |
| 58 EpollServer* epoll_server_; // Not owned. | |
| 59 | |
| 60 const QuicEpollClock clock_; | 46 const QuicEpollClock clock_; |
| 61 QuicRandom* random_generator_; | 47 QuicRandom* random_generator_; |
| 62 // Set up both allocators. They take up minimal memory before use. | 48 // Set up both allocators. They take up minimal memory before use. |
| 63 QuicStreamBufferAllocator buffer_allocator_; | 49 QuicStreamBufferAllocator buffer_allocator_; |
| 64 SimpleBufferAllocator simple_buffer_allocator_; | 50 SimpleBufferAllocator simple_buffer_allocator_; |
| 65 QuicAllocator allocator_type_; | 51 QuicAllocator allocator_type_; |
| 66 | 52 |
| 67 DISALLOW_COPY_AND_ASSIGN(QuicEpollConnectionHelper); | 53 DISALLOW_COPY_AND_ASSIGN(QuicEpollConnectionHelper); |
| 68 }; | 54 }; |
| 69 | 55 |
| 70 } // namespace net | 56 } // namespace net |
| 71 | 57 |
| 72 #endif // NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ | 58 #endif // NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ |
| OLD | NEW |