| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 SpdyFrame* rv = new SpdyFrame(buffer_.release(), length(), true); | 81 SpdyFrame* rv = new SpdyFrame(buffer_.release(), length(), true); |
| 82 capacity_ = 0; | 82 capacity_ = 0; |
| 83 length_ = 0; | 83 length_ = 0; |
| 84 offset_ = 0; | 84 offset_ = 0; |
| 85 return rv; | 85 return rv; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Methods for adding to the payload. These values are appended to the end | 88 // Methods for adding to the payload. These values are appended to the end |
| 89 // of the SpdyFrameBuilder payload. Note - binary integers are converted from | 89 // of the SpdyFrameBuilder payload. Note - binary integers are converted from |
| 90 // host to network form. | 90 // host to network form. |
| 91 bool WriteUInt8(uint8 value) { | 91 bool WriteUInt8(uint8 value) { return WriteBytes(&value, sizeof(value)); } |
| 92 return WriteBytes(&value, sizeof(value)); | |
| 93 } | |
| 94 bool WriteUInt16(uint16 value) { | 92 bool WriteUInt16(uint16 value) { |
| 95 value = htons(value); | 93 value = htons(value); |
| 96 return WriteBytes(&value, sizeof(value)); | 94 return WriteBytes(&value, sizeof(value)); |
| 97 } | 95 } |
| 98 bool WriteUInt32(uint32 value) { | 96 bool WriteUInt32(uint32 value) { |
| 99 value = htonl(value); | 97 value = htonl(value); |
| 100 return WriteBytes(&value, sizeof(value)); | 98 return WriteBytes(&value, sizeof(value)); |
| 101 } | 99 } |
| 102 bool WriteUInt64(uint64 value) { | 100 bool WriteUInt64(uint64 value) { |
| 103 uint32 upper = htonl(value >> 32); | 101 uint32 upper = htonl(value >> 32); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 size_t capacity_; // Allocation size of payload, set by constructor. | 136 size_t capacity_; // Allocation size of payload, set by constructor. |
| 139 size_t length_; // Length of the latest frame in the buffer. | 137 size_t length_; // Length of the latest frame in the buffer. |
| 140 size_t offset_; // Position at which the latest frame begins. | 138 size_t offset_; // Position at which the latest frame begins. |
| 141 | 139 |
| 142 const SpdyMajorVersion version_; | 140 const SpdyMajorVersion version_; |
| 143 }; | 141 }; |
| 144 | 142 |
| 145 } // namespace net | 143 } // namespace net |
| 146 | 144 |
| 147 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ | 145 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| OLD | NEW |