| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SpdyFrameType 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); | 132 uint8_t raw_frame_type = SerializeFrameType(type); |
| 133 DCHECK(IsDefinedFrameType(raw_frame_type)); | 133 DCHECK(IsDefinedFrameType(raw_frame_type)); |
| 134 return BeginNewFrame(framer, raw_frame_type, flags, stream_id, length); |
| 135 } |
| 136 |
| 137 bool SpdyFrameBuilder::BeginNewFrame(const SpdyFramer& framer, |
| 138 uint8_t raw_frame_type, |
| 139 uint8_t flags, |
| 140 SpdyStreamId stream_id, |
| 141 size_t length) { |
| 134 DCHECK_EQ(0u, stream_id & ~kStreamIdMask); | 142 DCHECK_EQ(0u, stream_id & ~kStreamIdMask); |
| 135 bool success = true; | 143 bool success = true; |
| 136 SPDY_BUG_IF(framer.GetFrameMaximumSize() < length_) | 144 SPDY_BUG_IF(framer.GetFrameMaximumSize() < length_) |
| 137 << "Frame length " << length_ | 145 << "Frame length " << length_ |
| 138 << " is longer than the maximum allowed length."; | 146 << " is longer than the maximum allowed length."; |
| 139 | 147 |
| 140 offset_ += length_; | 148 offset_ += length_; |
| 141 length_ = 0; | 149 length_ = 0; |
| 142 | 150 |
| 143 success &= WriteUInt24(length); | 151 success &= WriteUInt24(length); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } else { | 260 } else { |
| 253 if (length > output_->BytesFree()) { | 261 if (length > output_->BytesFree()) { |
| 254 return false; | 262 return false; |
| 255 } | 263 } |
| 256 } | 264 } |
| 257 | 265 |
| 258 return true; | 266 return true; |
| 259 } | 267 } |
| 260 | 268 |
| 261 } // namespace net | 269 } // namespace net |
| OLD | NEW |