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

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

Issue 2759203003: Landing Recent QUIC changes until Thu Mar 16 17:24:53 2017 +0000 (Closed)
Patch Set: float Created 3 years, 9 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"
11 #include "net/quic/platform/api/quic_endian.h"
12
10 namespace net { 13 namespace net {
11 14
12 QuicDataWriter::QuicDataWriter(size_t size, char* buffer) 15 QuicDataWriter::QuicDataWriter(size_t size, char* buffer)
13 : buffer_(buffer), capacity_(size), length_(0) {} 16 : buffer_(buffer), capacity_(size), length_(0) {}
14 17
15 QuicDataWriter::~QuicDataWriter() {} 18 QuicDataWriter::~QuicDataWriter() {}
16 19
17 char* QuicDataWriter::data() { 20 char* QuicDataWriter::data() {
18 return buffer_; 21 return buffer_;
19 } 22 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 134
132 void QuicDataWriter::WritePadding() { 135 void QuicDataWriter::WritePadding() {
133 DCHECK_LE(length_, capacity_); 136 DCHECK_LE(length_, capacity_);
134 if (length_ > capacity_) { 137 if (length_ > capacity_) {
135 return; 138 return;
136 } 139 }
137 memset(buffer_ + length_, 0x00, capacity_ - length_); 140 memset(buffer_ + length_, 0x00, capacity_ - length_);
138 length_ = capacity_; 141 length_ = capacity_;
139 } 142 }
140 143
144 bool QuicDataWriter::WriteConnectionId(uint64_t connection_id) {
145 if (FLAGS_quic_restart_flag_quic_big_endian_connection_id) {
146 connection_id = QuicEndian::HostToNet64(connection_id);
147 }
148
149 return WriteUInt64(connection_id);
150 }
151
141 } // namespace net 152 } // 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