| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 | 5 |
| 6 #ifndef NET_QUIC_QUIC_PACKET_READER_H_ | 6 #ifndef NET_QUIC_QUIC_PACKET_READER_H_ |
| 7 #define NET_QUIC_QUIC_PACKET_READER_H_ | 7 #define NET_QUIC_QUIC_PACKET_READER_H_ |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // milliseconds have passed, QuicPacketReader::StartReading() yields by doing a | 23 // milliseconds have passed, QuicPacketReader::StartReading() yields by doing a |
| 24 // QuicPacketReader::PostTask(). | 24 // QuicPacketReader::PostTask(). |
| 25 const int kQuicYieldAfterPacketsRead = 32; | 25 const int kQuicYieldAfterPacketsRead = 32; |
| 26 const int kQuicYieldAfterDurationMilliseconds = 20; | 26 const int kQuicYieldAfterDurationMilliseconds = 20; |
| 27 | 27 |
| 28 class NET_EXPORT_PRIVATE QuicPacketReader { | 28 class NET_EXPORT_PRIVATE QuicPacketReader { |
| 29 public: | 29 public: |
| 30 class NET_EXPORT_PRIVATE Visitor { | 30 class NET_EXPORT_PRIVATE Visitor { |
| 31 public: | 31 public: |
| 32 virtual ~Visitor(){}; | 32 virtual ~Visitor(){}; |
| 33 virtual void OnReadError(int result) = 0; | 33 virtual void OnReadError(int result, |
| 34 const DatagramClientSocket* socket) = 0; |
| 34 virtual bool OnPacket(const QuicEncryptedPacket& packet, | 35 virtual bool OnPacket(const QuicEncryptedPacket& packet, |
| 35 IPEndPoint local_address, | 36 IPEndPoint local_address, |
| 36 IPEndPoint peer_address) = 0; | 37 IPEndPoint peer_address) = 0; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 QuicPacketReader(DatagramClientSocket* socket, | 40 QuicPacketReader(DatagramClientSocket* socket, |
| 40 QuicClock* clock, | 41 QuicClock* clock, |
| 41 Visitor* visitor, | 42 Visitor* visitor, |
| 42 int yield_after_packets, | 43 int yield_after_packets, |
| 43 QuicTime::Delta yield_after_duration, | 44 QuicTime::Delta yield_after_duration, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 64 BoundNetLog net_log_; | 65 BoundNetLog net_log_; |
| 65 | 66 |
| 66 base::WeakPtrFactory<QuicPacketReader> weak_factory_; | 67 base::WeakPtrFactory<QuicPacketReader> weak_factory_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); | 69 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace net | 72 } // namespace net |
| 72 | 73 |
| 73 #endif // NET_QUIC_QUIC_PACKET_READER_H_ | 74 #endif // NET_QUIC_QUIC_PACKET_READER_H_ |
| OLD | NEW |