| 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_SPDY_FRAME_BUILDER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| 6 #define NET_SPDY_SPDY_FRAME_BUILDER_H_ | 6 #define NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // with the correct version for the frame being written. | 110 // with the correct version for the frame being written. |
| 111 bool RewriteLength(const SpdyFramer& framer); | 111 bool RewriteLength(const SpdyFramer& framer); |
| 112 | 112 |
| 113 // Update (in-place) the length field in the frame being built to reflect the | 113 // Update (in-place) the length field in the frame being built to reflect the |
| 114 // given length. | 114 // given length. |
| 115 // The framer parameter is used to determine version-specific location and | 115 // The framer parameter is used to determine version-specific location and |
| 116 // size information of the length field to be written, and must be initialized | 116 // size information of the length field to be written, and must be initialized |
| 117 // with the correct version for the frame being written. | 117 // with the correct version for the frame being written. |
| 118 bool OverwriteLength(const SpdyFramer& framer, size_t length); | 118 bool OverwriteLength(const SpdyFramer& framer, size_t length); |
| 119 | 119 |
| 120 // Update (in-place) the flags field in the frame being built to reflect the |
| 121 // given flags value. |
| 122 // Used only for SPDY versions >=4. |
| 123 bool OverwriteFlags(const SpdyFramer& framer, uint8 flags); |
| 124 |
| 120 private: | 125 private: |
| 121 // Checks to make sure that there is an appropriate amount of space for a | 126 // Checks to make sure that there is an appropriate amount of space for a |
| 122 // write of given size, in bytes. | 127 // write of given size, in bytes. |
| 123 bool CanWrite(size_t length) const; | 128 bool CanWrite(size_t length) const; |
| 124 | 129 |
| 125 scoped_ptr<char[]> buffer_; | 130 scoped_ptr<char[]> buffer_; |
| 126 size_t capacity_; // Allocation size of payload, set by constructor. | 131 size_t capacity_; // Allocation size of payload, set by constructor. |
| 127 size_t length_; // Current length of the buffer. | 132 size_t length_; // Current length of the buffer. |
| 128 }; | 133 }; |
| 129 | 134 |
| 130 } // namespace net | 135 } // namespace net |
| 131 | 136 |
| 132 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ | 137 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| OLD | NEW |