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/quic/core/quic_data_writer.h" | 5 #include "net/quic/core/quic_data_writer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "net/quic/core/quic_flags.h" | 10 #include "net/quic/core/quic_flags.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 void QuicDataWriter::WritePadding() { | 143 void QuicDataWriter::WritePadding() { |
144 DCHECK_LE(length_, capacity_); | 144 DCHECK_LE(length_, capacity_); |
145 if (length_ > capacity_) { | 145 if (length_ > capacity_) { |
146 return; | 146 return; |
147 } | 147 } |
148 memset(buffer_ + length_, 0x00, capacity_ - length_); | 148 memset(buffer_ + length_, 0x00, capacity_ - length_); |
149 length_ = capacity_; | 149 length_ = capacity_; |
150 } | 150 } |
151 | 151 |
| 152 bool QuicDataWriter::WritePaddingBytes(size_t count) { |
| 153 return WriteRepeatedByte(0x00, count); |
| 154 } |
| 155 |
152 bool QuicDataWriter::WriteConnectionId(uint64_t connection_id) { | 156 bool QuicDataWriter::WriteConnectionId(uint64_t connection_id) { |
153 if (FLAGS_quic_restart_flag_quic_big_endian_connection_id) { | 157 if (FLAGS_quic_restart_flag_quic_big_endian_connection_id) { |
154 connection_id = QuicEndian::HostToNet64(connection_id); | 158 connection_id = QuicEndian::HostToNet64(connection_id); |
155 } | 159 } |
156 | 160 |
157 return WriteUInt64(connection_id); | 161 return WriteUInt64(connection_id); |
158 } | 162 } |
159 | 163 |
160 bool QuicDataWriter::WriteTag(uint32_t tag) { | 164 bool QuicDataWriter::WriteTag(uint32_t tag) { |
161 return WriteBytes(&tag, sizeof(tag)); | 165 return WriteBytes(&tag, sizeof(tag)); |
162 } | 166 } |
163 | 167 |
164 } // namespace net | 168 } // namespace net |
OLD | NEW |