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> | |
12 | |
13 #include "base/macros.h" | 11 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | |
15 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.h" |
16 #include "net/quic/quic_connection.h" | 13 #include "net/quic/quic_connection.h" |
17 #include "net/quic/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
18 #include "net/quic/quic_simple_buffer_allocator.h" | 15 #include "net/quic/quic_simple_buffer_allocator.h" |
19 #include "net/quic/quic_time.h" | 16 #include "net/quic/quic_time.h" |
20 #include "net/udp/datagram_client_socket.h" | 17 #include "net/udp/datagram_client_socket.h" |
21 | 18 |
| 19 |
22 namespace base { | 20 namespace base { |
23 class TaskRunner; | 21 class TaskRunner; |
24 } // namespace base | 22 } // namespace base |
25 | 23 |
26 namespace net { | 24 namespace net { |
27 | 25 |
28 class QuicClock; | 26 class QuicClock; |
29 class QuicRandom; | 27 class QuicRandom; |
30 | 28 |
31 class NET_EXPORT_PRIVATE QuicChromiumConnectionHelper | 29 class NET_EXPORT_PRIVATE QuicChromiumConnectionHelper |
32 : public QuicConnectionHelperInterface { | 30 : public QuicConnectionHelperInterface { |
33 public: | 31 public: |
34 QuicChromiumConnectionHelper(base::TaskRunner* task_runner, | 32 QuicChromiumConnectionHelper(const QuicClock* clock, |
35 const QuicClock* clock, | |
36 QuicRandom* random_generator); | 33 QuicRandom* random_generator); |
37 ~QuicChromiumConnectionHelper() override; | 34 ~QuicChromiumConnectionHelper() override; |
38 | 35 |
39 // QuicConnectionHelperInterface | 36 // QuicConnectionHelperInterface |
40 const QuicClock* GetClock() const override; | 37 const QuicClock* GetClock() const override; |
41 QuicRandom* GetRandomGenerator() override; | 38 QuicRandom* GetRandomGenerator() override; |
42 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; | |
43 QuicArenaScopedPtr<QuicAlarm> CreateAlarm( | |
44 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, | |
45 QuicConnectionArena* arena) override; | |
46 QuicBufferAllocator* GetBufferAllocator() override; | 39 QuicBufferAllocator* GetBufferAllocator() override; |
47 | 40 |
48 private: | 41 private: |
49 base::TaskRunner* task_runner_; | |
50 const QuicClock* clock_; | 42 const QuicClock* clock_; |
51 QuicRandom* random_generator_; | 43 QuicRandom* random_generator_; |
52 SimpleBufferAllocator buffer_allocator_; | 44 SimpleBufferAllocator buffer_allocator_; |
53 base::WeakPtrFactory<QuicChromiumConnectionHelper> weak_factory_; | |
54 | 45 |
55 DISALLOW_COPY_AND_ASSIGN(QuicChromiumConnectionHelper); | 46 DISALLOW_COPY_AND_ASSIGN(QuicChromiumConnectionHelper); |
56 }; | 47 }; |
57 | 48 |
58 } // namespace net | 49 } // namespace net |
59 | 50 |
60 #endif // NET_QUIC_QUIC_CONNECTION_HELPER_H_ | 51 #endif // NET_QUIC_QUIC_CONNECTION_HELPER_H_ |
OLD | NEW |