Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: net/quic/core/quic_data_writer.cc

Issue 2808273006: Landing Recent QUIC changes until Sun Apr 9 16:12:55 (Closed)
Patch Set: increment enabled_options in e2e test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_data_writer.h ('k') | net/quic/core/quic_data_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/quic/core/quic_utils.h"
11 #include "net/quic/platform/api/quic_endian.h" 12 #include "net/quic/platform/api/quic_endian.h"
12 #include "net/quic/platform/api/quic_logging.h" 13 #include "net/quic/platform/api/quic_logging.h"
13 14
14 namespace net { 15 namespace net {
15 16
16 #define ENDPOINT \ 17 #define ENDPOINT \
17 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") 18 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
18 19
19 QuicDataWriter::QuicDataWriter(size_t size, 20 QuicDataWriter::QuicDataWriter(size_t size,
20 char* buffer, 21 char* buffer,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 void QuicDataWriter::WritePadding() { 144 void QuicDataWriter::WritePadding() {
144 DCHECK_LE(length_, capacity_); 145 DCHECK_LE(length_, capacity_);
145 if (length_ > capacity_) { 146 if (length_ > capacity_) {
146 return; 147 return;
147 } 148 }
148 memset(buffer_ + length_, 0x00, capacity_ - length_); 149 memset(buffer_ + length_, 0x00, capacity_ - length_);
149 length_ = capacity_; 150 length_ = capacity_;
150 } 151 }
151 152
153 bool QuicDataWriter::WritePaddingBytes(size_t count) {
154 return WriteRepeatedByte(0x00, count);
155 }
156
152 bool QuicDataWriter::WriteConnectionId(uint64_t connection_id) { 157 bool QuicDataWriter::WriteConnectionId(uint64_t connection_id) {
153 if (FLAGS_quic_restart_flag_quic_big_endian_connection_id) { 158 if (QuicUtils::IsConnectionIdWireFormatBigEndian(perspective_)) {
154 connection_id = QuicEndian::HostToNet64(connection_id); 159 connection_id = QuicEndian::HostToNet64(connection_id);
155 } 160 }
156 161
157 return WriteUInt64(connection_id); 162 return WriteUInt64(connection_id);
158 } 163 }
159 164
160 bool QuicDataWriter::WriteTag(uint32_t tag) { 165 bool QuicDataWriter::WriteTag(uint32_t tag) {
161 return WriteBytes(&tag, sizeof(tag)); 166 return WriteBytes(&tag, sizeof(tag));
162 } 167 }
163 168
164 } // namespace net 169 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_data_writer.h ('k') | net/quic/core/quic_data_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698