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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 // frame. | 733 // frame. |
734 struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {}; | 734 struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {}; |
735 | 735 |
736 class NET_EXPORT_PRIVATE QuicBufferAllocator { | 736 class NET_EXPORT_PRIVATE QuicBufferAllocator { |
737 public: | 737 public: |
738 virtual ~QuicBufferAllocator(); | 738 virtual ~QuicBufferAllocator(); |
739 | 739 |
740 // Returns or allocates a new buffer of |size|. Never returns null. | 740 // Returns or allocates a new buffer of |size|. Never returns null. |
741 virtual char* New(size_t size) = 0; | 741 virtual char* New(size_t size) = 0; |
742 | 742 |
| 743 // Returns or allocates a new buffer of |size| if |flag_enable| is true. |
| 744 // Otherwise, returns a buffer that is compatible with this class directly |
| 745 // with operator new. Never returns null. |
| 746 virtual char* New(size_t size, bool flag_enable) = 0; |
| 747 |
743 // Releases a buffer. | 748 // Releases a buffer. |
744 virtual void Delete(char* buffer) = 0; | 749 virtual void Delete(char* buffer) = 0; |
| 750 |
| 751 // Marks the allocator as being idle. Serves as a hint to notify the allocator |
| 752 // that it should release any resources it's still holding on to. |
| 753 virtual void MarkAllocatorIdle() {} |
745 }; | 754 }; |
746 | 755 |
747 // Deleter for stream buffers. Copyable to support platforms where the deleter | 756 // Deleter for stream buffers. Copyable to support platforms where the deleter |
748 // of a unique_ptr must be copyable. Otherwise it would be nice for this to be | 757 // of a unique_ptr must be copyable. Otherwise it would be nice for this to be |
749 // move-only. | 758 // move-only. |
750 class NET_EXPORT_PRIVATE StreamBufferDeleter { | 759 class NET_EXPORT_PRIVATE StreamBufferDeleter { |
751 public: | 760 public: |
752 StreamBufferDeleter() : allocator_(nullptr) {} | 761 StreamBufferDeleter() : allocator_(nullptr) {} |
753 explicit StreamBufferDeleter(QuicBufferAllocator* allocator) | 762 explicit StreamBufferDeleter(QuicBufferAllocator* allocator) |
754 : allocator_(allocator) {} | 763 : allocator_(allocator) {} |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1338 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
1330 | 1339 |
1331 const struct iovec* iov; | 1340 const struct iovec* iov; |
1332 const int iov_count; | 1341 const int iov_count; |
1333 const size_t total_length; | 1342 const size_t total_length; |
1334 }; | 1343 }; |
1335 | 1344 |
1336 } // namespace net | 1345 } // namespace net |
1337 | 1346 |
1338 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1347 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |