| 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 #include "net/spdy/spdy_frame_builder.h" | 5 #include "net/spdy/spdy_frame_builder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 success &= WriteUInt24(capacity_ - offset_ - kFrameHeaderSize); | 118 success &= WriteUInt24(capacity_ - offset_ - kFrameHeaderSize); |
| 119 } | 119 } |
| 120 success &= WriteUInt8(raw_frame_type); | 120 success &= WriteUInt8(raw_frame_type); |
| 121 success &= WriteUInt8(flags); | 121 success &= WriteUInt8(flags); |
| 122 success &= WriteUInt32(stream_id); | 122 success &= WriteUInt32(stream_id); |
| 123 DCHECK_EQ(framer.GetDataFrameMinimumSize(), length_); | 123 DCHECK_EQ(framer.GetDataFrameMinimumSize(), length_); |
| 124 return success; | 124 return success; |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool SpdyFrameBuilder::BeginNewFrame(const SpdyFramer& framer, | 127 bool SpdyFrameBuilder::BeginNewFrame(const SpdyFramer& framer, |
| 128 SpdyFrameType type, | 128 uint8_t raw_frame_type, |
| 129 uint8_t flags, | 129 uint8_t flags, |
| 130 SpdyStreamId stream_id, | 130 SpdyStreamId stream_id, |
| 131 size_t length) { | 131 size_t length) { |
| 132 uint8_t raw_frame_type = SerializeFrameType(type); | |
| 133 DCHECK(IsDefinedFrameType(raw_frame_type)); | |
| 134 DCHECK_EQ(0u, stream_id & ~kStreamIdMask); | 132 DCHECK_EQ(0u, stream_id & ~kStreamIdMask); |
| 135 bool success = true; | 133 bool success = true; |
| 136 SPDY_BUG_IF(framer.GetFrameMaximumSize() < length_) | 134 SPDY_BUG_IF(framer.GetFrameMaximumSize() < length_) |
| 137 << "Frame length " << length_ | 135 << "Frame length " << length_ |
| 138 << " is longer than the maximum allowed length."; | 136 << " is longer than the maximum allowed length."; |
| 139 | 137 |
| 140 offset_ += length_; | 138 offset_ += length_; |
| 141 length_ = 0; | 139 length_ = 0; |
| 142 | 140 |
| 143 success &= WriteUInt24(length); | 141 success &= WriteUInt24(length); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } else { | 250 } else { |
| 253 if (length > output_->BytesFree()) { | 251 if (length > output_->BytesFree()) { |
| 254 return false; | 252 return false; |
| 255 } | 253 } |
| 256 } | 254 } |
| 257 | 255 |
| 258 return true; | 256 return true; |
| 259 } | 257 } |
| 260 | 258 |
| 261 } // namespace net | 259 } // namespace net |
| OLD | NEW |