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_SPDY_CORE_SPDY_FRAME_BUILDER_H_ | 5 #ifndef NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ |
6 #define NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ | 6 #define NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/sys_byteorder.h" | 14 #include "base/sys_byteorder.h" |
15 #include "net/base/net_export.h" | |
16 #include "net/spdy/core/spdy_bug_tracker.h" | 15 #include "net/spdy/core/spdy_bug_tracker.h" |
17 #include "net/spdy/core/spdy_protocol.h" | 16 #include "net/spdy/core/spdy_protocol.h" |
18 #include "net/spdy/core/zero_copy_output_buffer.h" | 17 #include "net/spdy/core/zero_copy_output_buffer.h" |
| 18 #include "net/spdy/platform/api/spdy_export.h" |
19 #include "net/spdy/platform/api/spdy_string_piece.h" | 19 #include "net/spdy/platform/api/spdy_string_piece.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class SpdyFramer; | 23 class SpdyFramer; |
24 | 24 |
25 // This class provides facilities for basic binary value packing | 25 // This class provides facilities for basic binary value packing |
26 // into Spdy frames. | 26 // into Spdy frames. |
27 // | 27 // |
28 // The SpdyFrameBuilder supports appending primitive values (int, string, etc) | 28 // The SpdyFrameBuilder supports appending primitive values (int, string, etc) |
29 // to a frame instance. The SpdyFrameBuilder grows its internal memory buffer | 29 // to a frame instance. The SpdyFrameBuilder grows its internal memory buffer |
30 // dynamically to hold the sequence of primitive values. The internal memory | 30 // dynamically to hold the sequence of primitive values. The internal memory |
31 // buffer is exposed as the "data" of the SpdyFrameBuilder. | 31 // buffer is exposed as the "data" of the SpdyFrameBuilder. |
32 class NET_EXPORT_PRIVATE SpdyFrameBuilder { | 32 class SPDY_EXPORT_PRIVATE SpdyFrameBuilder { |
33 public: | 33 public: |
34 // Initializes a SpdyFrameBuilder with a buffer of given size | 34 // Initializes a SpdyFrameBuilder with a buffer of given size |
35 explicit SpdyFrameBuilder(size_t size); | 35 explicit SpdyFrameBuilder(size_t size); |
36 // Doesn't take ownership of output. | 36 // Doesn't take ownership of output. |
37 SpdyFrameBuilder(size_t size, ZeroCopyOutputBuffer* output); | 37 SpdyFrameBuilder(size_t size, ZeroCopyOutputBuffer* output); |
38 | 38 |
39 ~SpdyFrameBuilder(); | 39 ~SpdyFrameBuilder(); |
40 | 40 |
41 // Returns the total size of the SpdyFrameBuilder's data, which may include | 41 // Returns the total size of the SpdyFrameBuilder's data, which may include |
42 // multiple frames. | 42 // multiple frames. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const size_t kLengthFieldLength = 3; | 159 const size_t kLengthFieldLength = 3; |
160 char* start_of_current_frame_ = nullptr; | 160 char* start_of_current_frame_ = nullptr; |
161 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength; | 161 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength; |
162 // In case length of a new frame is cross blocks. | 162 // In case length of a new frame is cross blocks. |
163 char* start_of_current_frame_in_next_block_ = nullptr; | 163 char* start_of_current_frame_in_next_block_ = nullptr; |
164 }; | 164 }; |
165 | 165 |
166 } // namespace net | 166 } // namespace net |
167 | 167 |
168 #endif // NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ | 168 #endif // NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ |
OLD | NEW |