| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 DCHECK_EQ(framer.GetDataFrameMinimumSize(), length_); | 129 DCHECK_EQ(framer.GetDataFrameMinimumSize(), length_); |
| 130 return success; | 130 return success; |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool SpdyFrameBuilder::WriteStringPiece16(const base::StringPiece& value) { | 133 bool SpdyFrameBuilder::WriteStringPiece16(const base::StringPiece& value) { |
| 134 if (value.size() > 0xffff) { | 134 if (value.size() > 0xffff) { |
| 135 DCHECK(false) << "Tried to write string with length > 16bit."; | 135 DCHECK(false) << "Tried to write string with length > 16bit."; |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 if (!WriteUInt16(static_cast<uint16>(value.size()))) | 139 if (!WriteUInt16(static_cast<uint16>(value.size()))) { |
| 140 return false; | 140 return false; |
| 141 } |
| 141 | 142 |
| 142 return WriteBytes(value.data(), static_cast<uint16>(value.size())); | 143 return WriteBytes(value.data(), static_cast<uint16>(value.size())); |
| 143 } | 144 } |
| 144 | 145 |
| 145 bool SpdyFrameBuilder::WriteStringPiece32(const base::StringPiece& value) { | 146 bool SpdyFrameBuilder::WriteStringPiece32(const base::StringPiece& value) { |
| 146 if (!WriteUInt32(value.size())) { | 147 if (!WriteUInt32(value.size())) { |
| 147 return false; | 148 return false; |
| 148 } | 149 } |
| 149 | 150 |
| 150 return WriteBytes(value.data(), value.size()); | 151 return WriteBytes(value.data(), value.size()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 if (offset_ + length_ + length > capacity_) { | 218 if (offset_ + length_ + length > capacity_) { |
| 218 DCHECK(false); | 219 DCHECK(false); |
| 219 return false; | 220 return false; |
| 220 } | 221 } |
| 221 | 222 |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace net | 226 } // namespace net |
| OLD | NEW |