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

Side by Side Diff: net/spdy/spdy_frame_builder.h

Issue 1471073010: Removed unused include of winsock.h/inet.h from sys_byteorder.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include inet.h for things other than byte-swap Created 5 years 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/spdy/fuzzing/hpack_fuzz_util.cc ('k') | net/spdy/spdy_frame_builder.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 #ifndef NET_SPDY_SPDY_FRAME_BUILDER_H_ 5 #ifndef NET_SPDY_SPDY_FRAME_BUILDER_H_
6 #define NET_SPDY_SPDY_FRAME_BUILDER_H_ 6 #define NET_SPDY_SPDY_FRAME_BUILDER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return rv; 85 return rv;
86 } 86 }
87 87
88 // Methods for adding to the payload. These values are appended to the end 88 // Methods for adding to the payload. These values are appended to the end
89 // of the SpdyFrameBuilder payload. Note - binary integers are converted from 89 // of the SpdyFrameBuilder payload. Note - binary integers are converted from
90 // host to network form. 90 // host to network form.
91 bool WriteUInt8(uint8 value) { 91 bool WriteUInt8(uint8 value) {
92 return WriteBytes(&value, sizeof(value)); 92 return WriteBytes(&value, sizeof(value));
93 } 93 }
94 bool WriteUInt16(uint16 value) { 94 bool WriteUInt16(uint16 value) {
95 value = htons(value); 95 value = base::HostToNet16(value);
96 return WriteBytes(&value, sizeof(value)); 96 return WriteBytes(&value, sizeof(value));
97 } 97 }
98 bool WriteUInt24(uint32 value) { 98 bool WriteUInt24(uint32 value) {
99 value = htonl(value); 99 value = base::HostToNet32(value);
100 return WriteBytes(reinterpret_cast<char*>(&value) + 1, 100 return WriteBytes(reinterpret_cast<char*>(&value) + 1,
101 sizeof(value) - 1); 101 sizeof(value) - 1);
102 } 102 }
103 bool WriteUInt32(uint32 value) { 103 bool WriteUInt32(uint32 value) {
104 value = htonl(value); 104 value = base::HostToNet32(value);
105 return WriteBytes(&value, sizeof(value)); 105 return WriteBytes(&value, sizeof(value));
106 } 106 }
107 bool WriteUInt64(uint64 value) { 107 bool WriteUInt64(uint64 value) {
108 uint32 upper = htonl(value >> 32); 108 uint32 upper = base::HostToNet32(static_cast<uint32>(value >> 32));
109 uint32 lower = htonl(static_cast<uint32>(value)); 109 uint32 lower = base::HostToNet32(static_cast<uint32>(value));
110 return (WriteBytes(&upper, sizeof(upper)) && 110 return (WriteBytes(&upper, sizeof(upper)) &&
111 WriteBytes(&lower, sizeof(lower))); 111 WriteBytes(&lower, sizeof(lower)));
112 } 112 }
113 bool WriteStringPiece16(const base::StringPiece& value); 113 bool WriteStringPiece16(const base::StringPiece& value);
114 bool WriteStringPiece32(const base::StringPiece& value); 114 bool WriteStringPiece32(const base::StringPiece& value);
115 bool WriteBytes(const void* data, uint32 data_len); 115 bool WriteBytes(const void* data, uint32 data_len);
116 116
117 // Update (in-place) the length field in the frame being built to reflect the 117 // Update (in-place) the length field in the frame being built to reflect the
118 // current actual length of bytes written to said frame through this builder. 118 // current actual length of bytes written to said frame through this builder.
119 // The framer parameter is used to determine version-specific location and 119 // The framer parameter is used to determine version-specific location and
(...skipping 22 matching lines...) Expand all
142 size_t capacity_; // Allocation size of payload, set by constructor. 142 size_t capacity_; // Allocation size of payload, set by constructor.
143 size_t length_; // Length of the latest frame in the buffer. 143 size_t length_; // Length of the latest frame in the buffer.
144 size_t offset_; // Position at which the latest frame begins. 144 size_t offset_; // Position at which the latest frame begins.
145 145
146 const SpdyMajorVersion version_; 146 const SpdyMajorVersion version_;
147 }; 147 };
148 148
149 } // namespace net 149 } // namespace net
150 150
151 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ 151 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_
OLDNEW
« no previous file with comments | « net/spdy/fuzzing/hpack_fuzz_util.cc ('k') | net/spdy/spdy_frame_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698