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

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

Issue 199843005: Implement padding for SPDY4/HTTP2 DATA frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nullptr => NULL & discard padding at SpdySession visitor call. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_frame_builder.h ('k') | net/spdy/spdy_framer.h » ('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/spdy/spdy_frame_builder.h" 5 #include "net/spdy/spdy_frame_builder.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/spdy/spdy_framer.h" 10 #include "net/spdy/spdy_framer.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 flags, capacity_ - framer.GetControlFrameHeaderSize()); 68 flags, capacity_ - framer.GetControlFrameHeaderSize());
69 success &= WriteUInt16(kControlFlagMask | framer.protocol_version()); 69 success &= WriteUInt16(kControlFlagMask | framer.protocol_version());
70 success &= WriteUInt16(type); 70 success &= WriteUInt16(type);
71 success &= WriteBytes(&flags_length, sizeof(flags_length)); 71 success &= WriteBytes(&flags_length, sizeof(flags_length));
72 DCHECK_EQ(framer.GetControlFrameHeaderSize(), length()); 72 DCHECK_EQ(framer.GetControlFrameHeaderSize(), length());
73 return success; 73 return success;
74 } 74 }
75 75
76 bool SpdyFrameBuilder::WriteDataFrameHeader(const SpdyFramer& framer, 76 bool SpdyFrameBuilder::WriteDataFrameHeader(const SpdyFramer& framer,
77 SpdyStreamId stream_id, 77 SpdyStreamId stream_id,
78 SpdyDataFlags flags) { 78 uint8 flags) {
79 if (framer.protocol_version() >= 4) { 79 if (framer.protocol_version() >= 4) {
80 return WriteFramePrefix(framer, DATA, flags, stream_id); 80 return WriteFramePrefix(framer, DATA, flags, stream_id);
81 } 81 }
82 DCHECK_EQ(0u, stream_id & ~kStreamIdMask); 82 DCHECK_EQ(0u, stream_id & ~kStreamIdMask);
83 bool success = true; 83 bool success = true;
84 success &= WriteUInt32(stream_id); 84 success &= WriteUInt32(stream_id);
85 size_t length_field = capacity_ - framer.GetDataFrameMinimumSize(); 85 size_t length_field = capacity_ - framer.GetDataFrameMinimumSize();
86 DCHECK_EQ(0u, length_field & ~static_cast<size_t>(kLengthMask)); 86 DCHECK_EQ(0u, length_field & ~static_cast<size_t>(kLengthMask));
87 FlagsAndLength flags_length; 87 FlagsAndLength flags_length;
88 flags_length.length_ = htonl(length_field); 88 flags_length.length_ = htonl(length_field);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 if (length_ + length > capacity_) { 191 if (length_ + length > capacity_) {
192 DCHECK(false); 192 DCHECK(false);
193 return false; 193 return false;
194 } 194 }
195 195
196 return true; 196 return true;
197 } 197 }
198 198
199 } // namespace net 199 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_frame_builder.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698