| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/spdy/spdy_framer.h" | 10 #include "net/spdy/spdy_framer.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool SpdyFrameBuilder::RewriteLength(const SpdyFramer& framer) { | 153 bool SpdyFrameBuilder::RewriteLength(const SpdyFramer& framer) { |
| 154 return OverwriteLength(framer, | 154 return OverwriteLength(framer, |
| 155 length_ - framer.GetControlFrameHeaderSize()); | 155 length_ - framer.GetControlFrameHeaderSize()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool SpdyFrameBuilder::OverwriteLength(const SpdyFramer& framer, | 158 bool SpdyFrameBuilder::OverwriteLength(const SpdyFramer& framer, |
| 159 size_t length) { | 159 size_t length) { |
| 160 if (framer.protocol_version() < 4) { | 160 if (framer.protocol_version() < 4) { |
| 161 DCHECK_GT(framer.GetFrameMaximumSize() - framer.GetFrameMinimumSize(), | 161 DCHECK_GE(framer.GetFrameMaximumSize() - framer.GetFrameMinimumSize(), |
| 162 length); | 162 length); |
| 163 } else { | 163 } else { |
| 164 DCHECK_GE(framer.GetFrameMaximumSize(), length); | 164 DCHECK_GE(framer.GetFrameMaximumSize(), length); |
| 165 } | 165 } |
| 166 bool success = false; | 166 bool success = false; |
| 167 const size_t old_length = length_; | 167 const size_t old_length = length_; |
| 168 | 168 |
| 169 if (framer.protocol_version() < 4) { | 169 if (framer.protocol_version() < 4) { |
| 170 FlagsAndLength flags_length = CreateFlagsAndLength( | 170 FlagsAndLength flags_length = CreateFlagsAndLength( |
| 171 0, // We're not writing over the flags value anyway. | 171 0, // We're not writing over the flags value anyway. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 if (length_ + length > capacity_) { | 205 if (length_ + length > capacity_) { |
| 206 DCHECK(false); | 206 DCHECK(false); |
| 207 return false; | 207 return false; |
| 208 } | 208 } |
| 209 | 209 |
| 210 return true; | 210 return true; |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace net | 213 } // namespace net |
| OLD | NEW |