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

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

Issue 12258005: Remove SpdyWindowUpdateControlFrame. Useful in SPDY 4 development. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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_framer.h ('k') | net/spdy/spdy_framer_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 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't 5 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't
6 // constantly adding and subtracting header sizes; this is ugly and error- 6 // constantly adding and subtracting header sizes; this is ugly and error-
7 // prone. 7 // prone.
8 8
9 #include "net/spdy/spdy_framer.h" 9 #include "net/spdy/spdy_framer.h"
10 10
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 DCHECK(!control_frame.has_header_block()); 1182 DCHECK(!control_frame.has_header_block());
1183 // Use frame-specific handlers. 1183 // Use frame-specific handlers.
1184 switch (control_frame.type()) { 1184 switch (control_frame.type()) {
1185 case PING: { 1185 case PING: {
1186 SpdyPingControlFrame* ping_frame = 1186 SpdyPingControlFrame* ping_frame =
1187 reinterpret_cast<SpdyPingControlFrame*>(&control_frame); 1187 reinterpret_cast<SpdyPingControlFrame*>(&control_frame);
1188 visitor_->OnPing(ping_frame->unique_id()); 1188 visitor_->OnPing(ping_frame->unique_id());
1189 } 1189 }
1190 break; 1190 break;
1191 case WINDOW_UPDATE: { 1191 case WINDOW_UPDATE: {
1192 SpdyWindowUpdateControlFrame *window_update_frame = 1192 SpdyFrameReader reader(current_frame_buffer_.get(),
1193 reinterpret_cast<SpdyWindowUpdateControlFrame*>(&control_frame); 1193 current_frame_len_);
1194 visitor_->OnWindowUpdate(window_update_frame->stream_id(), 1194 reader.Seek(SpdyFrame::kHeaderSize); // Seek past frame header.
1195 window_update_frame->delta_window_size()); 1195 SpdyStreamId stream_id = kInvalidStream;
1196 uint32 delta_window_size = 0;
1197 bool successful_read = reader.ReadUInt31(&stream_id);
1198 DCHECK(successful_read);
1199 successful_read = reader.ReadUInt32(&delta_window_size);
1200 DCHECK(successful_read);
1201 DCHECK(reader.IsDoneReading());
1202 visitor_->OnWindowUpdate(stream_id, delta_window_size);
1196 } 1203 }
1197 break; 1204 break;
1198 case RST_STREAM: { 1205 case RST_STREAM: {
1199 SpdyRstStreamControlFrame* rst_stream_frame = 1206 SpdyRstStreamControlFrame* rst_stream_frame =
1200 reinterpret_cast<SpdyRstStreamControlFrame*>(&control_frame); 1207 reinterpret_cast<SpdyRstStreamControlFrame*>(&control_frame);
1201 visitor_->OnRstStream(rst_stream_frame->stream_id(), 1208 visitor_->OnRstStream(rst_stream_frame->stream_id(),
1202 rst_stream_frame->status()); 1209 rst_stream_frame->status());
1203 } 1210 }
1204 break; 1211 break;
1205 case GOAWAY: { 1212 case GOAWAY: {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 builder.WriteUInt16(0); // Unused. 1645 builder.WriteUInt16(0); // Unused.
1639 } 1646 }
1640 DCHECK_EQ(GetHeadersMinimumSize(), builder.length()); 1647 DCHECK_EQ(GetHeadersMinimumSize(), builder.length());
1641 1648
1642 SerializeNameValueBlock(&builder, headers); 1649 SerializeNameValueBlock(&builder, headers);
1643 DCHECK_EQ(size, builder.length()); 1650 DCHECK_EQ(size, builder.length());
1644 1651
1645 return builder.take(); 1652 return builder.take();
1646 } 1653 }
1647 1654
1648 SpdyWindowUpdateControlFrame* SpdyFramer::CreateWindowUpdate( 1655 SpdyFrame* SpdyFramer::CreateWindowUpdate(
1649 SpdyStreamId stream_id, 1656 SpdyStreamId stream_id,
1650 uint32 delta_window_size) const { 1657 uint32 delta_window_size) const {
1651 SpdyWindowUpdateIR window_update(stream_id, delta_window_size); 1658 SpdyWindowUpdateIR window_update(stream_id, delta_window_size);
1652 return reinterpret_cast<SpdyWindowUpdateControlFrame*>( 1659 return SerializeWindowUpdate(window_update);
1653 SerializeWindowUpdate(window_update));
1654 } 1660 }
1655 1661
1656 SpdySerializedFrame* SpdyFramer::SerializeWindowUpdate( 1662 SpdySerializedFrame* SpdyFramer::SerializeWindowUpdate(
1657 const SpdyWindowUpdateIR& window_update) const { 1663 const SpdyWindowUpdateIR& window_update) const {
1658 SpdyFrameBuilder builder(WINDOW_UPDATE, 1664 SpdyFrameBuilder builder(WINDOW_UPDATE,
1659 kNoFlags, 1665 kNoFlags,
1660 protocol_version(), 1666 protocol_version(),
1661 GetWindowUpdateSize()); 1667 GetWindowUpdateSize());
1662 builder.WriteUInt32(window_update.stream_id()); 1668 builder.WriteUInt32(window_update.stream_id());
1663 builder.WriteUInt32(window_update.delta()); 1669 builder.WriteUInt32(window_update.delta());
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 builder->WriteString(it->first); 2066 builder->WriteString(it->first);
2061 builder->WriteString(it->second); 2067 builder->WriteString(it->second);
2062 } else { 2068 } else {
2063 builder->WriteStringPiece32(it->first); 2069 builder->WriteStringPiece32(it->first);
2064 builder->WriteStringPiece32(it->second); 2070 builder->WriteStringPiece32(it->second);
2065 } 2071 }
2066 } 2072 }
2067 } 2073 }
2068 2074
2069 } // namespace net 2075 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698