OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_CORE_FRAMES_QUIC_STREAM_FRAME_H_ | 5 #ifndef NET_QUIC_CORE_FRAMES_QUIC_STREAM_FRAME_H_ |
6 #define NET_QUIC_CORE_FRAMES_QUIC_STREAM_FRAME_H_ | 6 #define NET_QUIC_CORE_FRAMES_QUIC_STREAM_FRAME_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <ostream> | 9 #include <ostream> |
10 | 10 |
11 #include "base/strings/string_piece.h" | |
12 #include "net/quic/core/quic_buffer_allocator.h" | 11 #include "net/quic/core/quic_buffer_allocator.h" |
13 #include "net/quic/core/quic_types.h" | 12 #include "net/quic/core/quic_types.h" |
14 #include "net/quic/platform/api/quic_export.h" | 13 #include "net/quic/platform/api/quic_export.h" |
| 14 #include "net/quic/platform/api/quic_string_piece.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 // Deleter for stream buffers. Copyable to support platforms where the deleter | 18 // Deleter for stream buffers. Copyable to support platforms where the deleter |
19 // of a unique_ptr must be copyable. Otherwise it would be nice for this to be | 19 // of a unique_ptr must be copyable. Otherwise it would be nice for this to be |
20 // move-only. | 20 // move-only. |
21 class QUIC_EXPORT_PRIVATE StreamBufferDeleter { | 21 class QUIC_EXPORT_PRIVATE StreamBufferDeleter { |
22 public: | 22 public: |
23 StreamBufferDeleter() : allocator_(nullptr) {} | 23 StreamBufferDeleter() : allocator_(nullptr) {} |
24 explicit StreamBufferDeleter(QuicBufferAllocator* allocator) | 24 explicit StreamBufferDeleter(QuicBufferAllocator* allocator) |
(...skipping 12 matching lines...) Expand all Loading... |
37 | 37 |
38 // Allocates memory of size |size| using |allocator| for a QUIC stream buffer. | 38 // Allocates memory of size |size| using |allocator| for a QUIC stream buffer. |
39 QUIC_EXPORT_PRIVATE UniqueStreamBuffer | 39 QUIC_EXPORT_PRIVATE UniqueStreamBuffer |
40 NewStreamBuffer(QuicBufferAllocator* allocator, size_t size); | 40 NewStreamBuffer(QuicBufferAllocator* allocator, size_t size); |
41 | 41 |
42 struct QUIC_EXPORT_PRIVATE QuicStreamFrame { | 42 struct QUIC_EXPORT_PRIVATE QuicStreamFrame { |
43 QuicStreamFrame(); | 43 QuicStreamFrame(); |
44 QuicStreamFrame(QuicStreamId stream_id, | 44 QuicStreamFrame(QuicStreamId stream_id, |
45 bool fin, | 45 bool fin, |
46 QuicStreamOffset offset, | 46 QuicStreamOffset offset, |
47 base::StringPiece data); | 47 QuicStringPiece data); |
48 QuicStreamFrame(QuicStreamId stream_id, | 48 QuicStreamFrame(QuicStreamId stream_id, |
49 bool fin, | 49 bool fin, |
50 QuicStreamOffset offset, | 50 QuicStreamOffset offset, |
51 QuicPacketLength data_length, | 51 QuicPacketLength data_length, |
52 UniqueStreamBuffer buffer); | 52 UniqueStreamBuffer buffer); |
53 ~QuicStreamFrame(); | 53 ~QuicStreamFrame(); |
54 | 54 |
55 friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 55 friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
56 const QuicStreamFrame& s); | 56 const QuicStreamFrame& s); |
57 | 57 |
(...skipping 14 matching lines...) Expand all Loading... |
72 UniqueStreamBuffer buffer); | 72 UniqueStreamBuffer buffer); |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(QuicStreamFrame); | 74 DISALLOW_COPY_AND_ASSIGN(QuicStreamFrame); |
75 }; | 75 }; |
76 static_assert(sizeof(QuicStreamFrame) <= 64, | 76 static_assert(sizeof(QuicStreamFrame) <= 64, |
77 "Keep the QuicStreamFrame size to a cacheline."); | 77 "Keep the QuicStreamFrame size to a cacheline."); |
78 | 78 |
79 } // namespace net | 79 } // namespace net |
80 | 80 |
81 #endif // NET_QUIC_CORE_FRAMES_QUIC_STREAM_FRAME_H_ | 81 #endif // NET_QUIC_CORE_FRAMES_QUIC_STREAM_FRAME_H_ |
OLD | NEW |