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 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ | 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ |
6 #define NET_QUIC_QUIC_PROTOCOL_H_ | 6 #define NET_QUIC_QUIC_PROTOCOL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/macros.h" | 23 #include "base/macros.h" |
24 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
25 #include "base/strings/string_piece.h" | 25 #include "base/strings/string_piece.h" |
26 #include "net/base/int128.h" | 26 #include "net/base/int128.h" |
27 #include "net/base/iovec.h" | 27 #include "net/base/iovec.h" |
28 #include "net/base/ip_endpoint.h" | 28 #include "net/base/ip_endpoint.h" |
29 #include "net/base/net_export.h" | 29 #include "net/base/net_export.h" |
30 #include "net/quic/core/interval_set.h" | 30 #include "net/quic/core/interval_set.h" |
31 #include "net/quic/core/quic_bandwidth.h" | 31 #include "net/quic/core/quic_bandwidth.h" |
| 32 #include "net/quic/core/quic_buffer_allocator.h" |
32 #include "net/quic/core/quic_constants.h" | 33 #include "net/quic/core/quic_constants.h" |
33 #include "net/quic/core/quic_time.h" | 34 #include "net/quic/core/quic_time.h" |
34 #include "net/quic/core/quic_types.h" | 35 #include "net/quic/core/quic_types.h" |
35 #include "net/quic/core/quic_versions.h" | 36 #include "net/quic/core/quic_versions.h" |
36 | 37 |
37 namespace net { | 38 namespace net { |
38 | 39 |
39 class QuicPacket; | 40 class QuicPacket; |
40 struct QuicPacketHeader; | 41 struct QuicPacketHeader; |
41 class QuicAckListenerInterface; | 42 class QuicAckListenerInterface; |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 }; | 557 }; |
557 | 558 |
558 // A ping frame contains no payload, though it is retransmittable, | 559 // A ping frame contains no payload, though it is retransmittable, |
559 // and ACK'd just like other normal frames. | 560 // and ACK'd just like other normal frames. |
560 struct NET_EXPORT_PRIVATE QuicPingFrame {}; | 561 struct NET_EXPORT_PRIVATE QuicPingFrame {}; |
561 | 562 |
562 // A path MTU discovery frame contains no payload and is serialized as a ping | 563 // A path MTU discovery frame contains no payload and is serialized as a ping |
563 // frame. | 564 // frame. |
564 struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {}; | 565 struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {}; |
565 | 566 |
566 class NET_EXPORT_PRIVATE QuicBufferAllocator { | |
567 public: | |
568 virtual ~QuicBufferAllocator(); | |
569 | |
570 // Returns or allocates a new buffer of |size|. Never returns null. | |
571 virtual char* New(size_t size) = 0; | |
572 | |
573 // Returns or allocates a new buffer of |size| if |flag_enable| is true. | |
574 // Otherwise, returns a buffer that is compatible with this class directly | |
575 // with operator new. Never returns null. | |
576 virtual char* New(size_t size, bool flag_enable) = 0; | |
577 | |
578 // Releases a buffer. | |
579 virtual void Delete(char* buffer) = 0; | |
580 | |
581 // Marks the allocator as being idle. Serves as a hint to notify the allocator | |
582 // that it should release any resources it's still holding on to. | |
583 virtual void MarkAllocatorIdle() {} | |
584 }; | |
585 | |
586 // Deleter for stream buffers. Copyable to support platforms where the deleter | 567 // Deleter for stream buffers. Copyable to support platforms where the deleter |
587 // of a unique_ptr must be copyable. Otherwise it would be nice for this to be | 568 // of a unique_ptr must be copyable. Otherwise it would be nice for this to be |
588 // move-only. | 569 // move-only. |
589 class NET_EXPORT_PRIVATE StreamBufferDeleter { | 570 class NET_EXPORT_PRIVATE StreamBufferDeleter { |
590 public: | 571 public: |
591 StreamBufferDeleter() : allocator_(nullptr) {} | 572 StreamBufferDeleter() : allocator_(nullptr) {} |
592 explicit StreamBufferDeleter(QuicBufferAllocator* allocator) | 573 explicit StreamBufferDeleter(QuicBufferAllocator* allocator) |
593 : allocator_(allocator) {} | 574 : allocator_(allocator) {} |
594 | 575 |
595 // Deletes |buffer| using |allocator_|. | 576 // Deletes |buffer| using |allocator_|. |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1258 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
1278 | 1259 |
1279 const struct iovec* iov; | 1260 const struct iovec* iov; |
1280 const int iov_count; | 1261 const int iov_count; |
1281 const size_t total_length; | 1262 const size_t total_length; |
1282 }; | 1263 }; |
1283 | 1264 |
1284 } // namespace net | 1265 } // namespace net |
1285 | 1266 |
1286 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1267 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |