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 |
22 namespace base { | 19 namespace base { |
23 class TaskRunner; | 20 class TaskRunner; |
24 } // namespace base | 21 } // namespace base |
25 | 22 |
26 namespace net { | 23 namespace net { |
27 | 24 |
28 class QuicClock; | 25 class QuicClock; |
29 class QuicRandom; | 26 class QuicRandom; |
30 | 27 |
31 class NET_EXPORT_PRIVATE QuicChromiumConnectionHelper | 28 class NET_EXPORT_PRIVATE QuicChromiumConnectionHelper |
32 : public QuicConnectionHelperInterface { | 29 : public QuicConnectionHelperInterface { |
33 public: | 30 public: |
34 QuicChromiumConnectionHelper(base::TaskRunner* task_runner, | 31 QuicChromiumConnectionHelper(const QuicClock* clock, |
35 const QuicClock* clock, | |
36 QuicRandom* random_generator); | 32 QuicRandom* random_generator); |
37 ~QuicChromiumConnectionHelper() override; | 33 ~QuicChromiumConnectionHelper() override; |
38 | 34 |
39 // QuicConnectionHelperInterface | 35 // QuicConnectionHelperInterface |
40 const QuicClock* GetClock() const override; | 36 const QuicClock* GetClock() const override; |
41 QuicRandom* GetRandomGenerator() override; | 37 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; | 38 QuicBufferAllocator* GetBufferAllocator() override; |
47 | 39 |
48 private: | 40 private: |
49 base::TaskRunner* task_runner_; | |
50 const QuicClock* clock_; | 41 const QuicClock* clock_; |
51 QuicRandom* random_generator_; | 42 QuicRandom* random_generator_; |
52 SimpleBufferAllocator buffer_allocator_; | 43 SimpleBufferAllocator buffer_allocator_; |
53 base::WeakPtrFactory<QuicChromiumConnectionHelper> weak_factory_; | |
54 | 44 |
55 DISALLOW_COPY_AND_ASSIGN(QuicChromiumConnectionHelper); | 45 DISALLOW_COPY_AND_ASSIGN(QuicChromiumConnectionHelper); |
56 }; | 46 }; |
57 | 47 |
58 } // namespace net | 48 } // namespace net |
59 | 49 |
60 #endif // NET_QUIC_QUIC_CONNECTION_HELPER_H_ | 50 #endif // NET_QUIC_QUIC_CONNECTION_HELPER_H_ |
OLD | NEW |