| 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_CORE_QUIC_DATA_WRITER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_DATA_WRITER_H_ |
| 6 #define NET_QUIC_CORE_QUIC_DATA_WRITER_H_ | 6 #define NET_QUIC_CORE_QUIC_DATA_WRITER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <cstddef> | 11 #include <cstddef> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 17 #include "net/base/int128.h" | 17 #include "net/base/int128.h" |
| 18 #include "net/base/net_export.h" | |
| 19 #include "net/quic/core/quic_packets.h" | 18 #include "net/quic/core/quic_packets.h" |
| 19 #include "net/quic/platform/api/quic_export.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 // This class provides facilities for packing QUIC data. | 23 // This class provides facilities for packing QUIC data. |
| 24 // | 24 // |
| 25 // The QuicDataWriter supports appending primitive values (int, string, etc) | 25 // The QuicDataWriter supports appending primitive values (int, string, etc) |
| 26 // to a frame instance. The internal memory buffer is exposed as the "data" | 26 // to a frame instance. The internal memory buffer is exposed as the "data" |
| 27 // of the QuicDataWriter. | 27 // of the QuicDataWriter. |
| 28 class NET_EXPORT_PRIVATE QuicDataWriter { | 28 class QUIC_EXPORT_PRIVATE QuicDataWriter { |
| 29 public: | 29 public: |
| 30 // Creates a QuicDataWriter where |buffer| is not owned. | 30 // Creates a QuicDataWriter where |buffer| is not owned. |
| 31 QuicDataWriter(size_t size, char* buffer); | 31 QuicDataWriter(size_t size, char* buffer); |
| 32 | 32 |
| 33 ~QuicDataWriter(); | 33 ~QuicDataWriter(); |
| 34 | 34 |
| 35 // Returns the size of the QuicDataWriter's data. | 35 // Returns the size of the QuicDataWriter's data. |
| 36 size_t length() const { return length_; } | 36 size_t length() const { return length_; } |
| 37 | 37 |
| 38 // Retrieves the buffer from the QuicDataWriter without changing ownership. | 38 // Retrieves the buffer from the QuicDataWriter without changing ownership. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 char* buffer_; | 67 char* buffer_; |
| 68 size_t capacity_; // Allocation size of payload (or -1 if buffer is const). | 68 size_t capacity_; // Allocation size of payload (or -1 if buffer is const). |
| 69 size_t length_; // Current length of the buffer. | 69 size_t length_; // Current length of the buffer. |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(QuicDataWriter); | 71 DISALLOW_COPY_AND_ASSIGN(QuicDataWriter); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace net | 74 } // namespace net |
| 75 | 75 |
| 76 #endif // NET_QUIC_CORE_QUIC_DATA_WRITER_H_ | 76 #endif // NET_QUIC_CORE_QUIC_DATA_WRITER_H_ |
| OLD | NEW |