| 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 #include "net/tools/quic/quic_epoll_connection_helper.h" | 5 #include "net/tools/quic/quic_epoll_connection_helper.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "net/quic/core/crypto/quic_random.h" | 12 #include "net/quic/core/crypto/quic_random.h" |
| 13 #include "net/tools/epoll_server/epoll_server.h" | 13 #include "net/tools/epoll_server/epoll_server.h" |
| 14 #include "net/tools/quic/quic_socket_utils.h" | 14 #include "net/tools/quic/platform/impl/quic_socket_utils.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 QuicEpollConnectionHelper::QuicEpollConnectionHelper(EpollServer* epoll_server, | 18 QuicEpollConnectionHelper::QuicEpollConnectionHelper(EpollServer* epoll_server, |
| 19 QuicAllocator type) | 19 QuicAllocator type) |
| 20 : clock_(epoll_server), | 20 : clock_(epoll_server), |
| 21 random_generator_(QuicRandom::GetInstance()), | 21 random_generator_(QuicRandom::GetInstance()), |
| 22 allocator_type_(type) {} | 22 allocator_type_(type) {} |
| 23 | 23 |
| 24 QuicEpollConnectionHelper::~QuicEpollConnectionHelper() {} | 24 QuicEpollConnectionHelper::~QuicEpollConnectionHelper() {} |
| 25 | 25 |
| 26 const QuicClock* QuicEpollConnectionHelper::GetClock() const { | 26 const QuicClock* QuicEpollConnectionHelper::GetClock() const { |
| 27 return &clock_; | 27 return &clock_; |
| 28 } | 28 } |
| 29 | 29 |
| 30 QuicRandom* QuicEpollConnectionHelper::GetRandomGenerator() { | 30 QuicRandom* QuicEpollConnectionHelper::GetRandomGenerator() { |
| 31 return random_generator_; | 31 return random_generator_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 QuicBufferAllocator* QuicEpollConnectionHelper::GetBufferAllocator() { | 34 QuicBufferAllocator* QuicEpollConnectionHelper::GetBufferAllocator() { |
| 35 if (allocator_type_ == QuicAllocator::BUFFER_POOL) { | 35 if (allocator_type_ == QuicAllocator::BUFFER_POOL) { |
| 36 return &buffer_allocator_; | 36 return &buffer_allocator_; |
| 37 } else { | 37 } else { |
| 38 DCHECK(allocator_type_ == QuicAllocator::SIMPLE); | 38 DCHECK(allocator_type_ == QuicAllocator::SIMPLE); |
| 39 return &simple_buffer_allocator_; | 39 return &simple_buffer_allocator_; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace net | 43 } // namespace net |
| OLD | NEW |