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 Chrome-specific helper for QuicConnection which uses | 5 // The Chrome-specific helper for QuicConnection which uses |
6 // a TaskRunner for alarms, and uses a DatagramClientSocket for writing data. | 6 // a TaskRunner for alarms, and uses a DatagramClientSocket for writing data. |
7 | 7 |
8 #ifndef NET_QUIC_QUIC_CONNECTION_HELPER_H_ | 8 #ifndef NET_QUIC_QUIC_CONNECTION_HELPER_H_ |
9 #define NET_QUIC_QUIC_CONNECTION_HELPER_H_ | 9 #define NET_QUIC_QUIC_CONNECTION_HELPER_H_ |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
| 16 #include "net/quic/quic_buffer_pool.h" |
16 #include "net/quic/quic_connection.h" | 17 #include "net/quic/quic_connection.h" |
17 #include "net/quic/quic_protocol.h" | 18 #include "net/quic/quic_protocol.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/udp/datagram_client_socket.h" | 20 #include "net/udp/datagram_client_socket.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class TaskRunner; | 23 class TaskRunner; |
24 } // namespace base | 24 } // namespace base |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 class QuicClock; | 28 class QuicClock; |
(...skipping 10 matching lines...) Expand all Loading... |
39 // QuicConnectionHelperInterface | 39 // QuicConnectionHelperInterface |
40 const QuicClock* GetClock() const override; | 40 const QuicClock* GetClock() const override; |
41 QuicRandom* GetRandomGenerator() override; | 41 QuicRandom* GetRandomGenerator() override; |
42 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; | 42 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; |
43 QuicBufferAllocator* GetBufferAllocator() override; | 43 QuicBufferAllocator* GetBufferAllocator() override; |
44 | 44 |
45 private: | 45 private: |
46 base::TaskRunner* task_runner_; | 46 base::TaskRunner* task_runner_; |
47 const QuicClock* clock_; | 47 const QuicClock* clock_; |
48 QuicRandom* random_generator_; | 48 QuicRandom* random_generator_; |
49 SimpleBufferAllocator buffer_allocator_; | 49 // Create a buffer free list using no more than 8 * 8MB memory. |
| 50 QuicBufferPool<kMaxPacketSize, 8> buffer_allocator_; |
50 base::WeakPtrFactory<QuicChromiumConnectionHelper> weak_factory_; | 51 base::WeakPtrFactory<QuicChromiumConnectionHelper> weak_factory_; |
51 | 52 |
52 DISALLOW_COPY_AND_ASSIGN(QuicChromiumConnectionHelper); | 53 DISALLOW_COPY_AND_ASSIGN(QuicChromiumConnectionHelper); |
53 }; | 54 }; |
54 | 55 |
55 } // namespace net | 56 } // namespace net |
56 | 57 |
57 #endif // NET_QUIC_QUIC_CONNECTION_HELPER_H_ | 58 #endif // NET_QUIC_QUIC_CONNECTION_HELPER_H_ |
OLD | NEW |