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