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

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

Issue 21820003: DO NOT COMMIT: SPDY 4: Hack SpdyFramer to turn SYN_STREAM and SYN_REPLY into HEADERS semi-transpare… Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for draft 06 Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Methods for adding to the payload. These values are appended to the end 81 // Methods for adding to the payload. These values are appended to the end
82 // of the SpdyFrameBuilder payload. Note - binary integers are converted from 82 // of the SpdyFrameBuilder payload. Note - binary integers are converted from
83 // host to network form. 83 // host to network form.
84 bool WriteUInt8(uint8 value) { 84 bool WriteUInt8(uint8 value) {
85 return WriteBytes(&value, sizeof(value)); 85 return WriteBytes(&value, sizeof(value));
86 } 86 }
87 bool WriteUInt16(uint16 value) { 87 bool WriteUInt16(uint16 value) {
88 value = htons(value); 88 value = htons(value);
89 return WriteBytes(&value, sizeof(value)); 89 return WriteBytes(&value, sizeof(value));
90 } 90 }
91 bool WriteUInt24(uint32 value) {
92 DCHECK_EQ(value >> 24, 0u);
93 return
94 WriteUInt8(static_cast<uint8>(value >> 16)) &&
95 WriteUInt8(static_cast<uint8>(value >> 8)) &&
96 WriteUInt8(static_cast<uint8>(value >> 0));
97 }
91 bool WriteUInt32(uint32 value) { 98 bool WriteUInt32(uint32 value) {
92 value = htonl(value); 99 value = htonl(value);
93 return WriteBytes(&value, sizeof(value)); 100 return WriteBytes(&value, sizeof(value));
94 } 101 }
95 // TODO(hkhalil) Rename to WriteStringPiece16(). 102 // TODO(hkhalil) Rename to WriteStringPiece16().
96 bool WriteString(const std::string& value); 103 bool WriteString(const std::string& value);
97 bool WriteStringPiece32(const base::StringPiece& value); 104 bool WriteStringPiece32(const base::StringPiece& value);
98 bool WriteBytes(const void* data, uint32 data_len); 105 bool WriteBytes(const void* data, uint32 data_len);
99 106
100 // Update (in-place) the length field in the frame being built to reflect the 107 // Update (in-place) the length field in the frame being built to reflect the
(...skipping 16 matching lines...) Expand all
117 bool CanWrite(size_t length) const; 124 bool CanWrite(size_t length) const;
118 125
119 scoped_ptr<char[]> buffer_; 126 scoped_ptr<char[]> buffer_;
120 size_t capacity_; // Allocation size of payload, set by constructor. 127 size_t capacity_; // Allocation size of payload, set by constructor.
121 size_t length_; // Current length of the buffer. 128 size_t length_; // Current length of the buffer.
122 }; 129 };
123 130
124 } // namespace net 131 } // namespace net
125 132
126 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ 133 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_frame_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698