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

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

Issue 2675593002: Spdy{RstStream,GoAway}Status -> SpdyErrorCode. (Closed)
Patch Set: Merged master, which includes 145087791. Created 3 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
« no previous file with comments | « net/spdy/buffered_spdy_framer.h ('k') | net/spdy/buffered_spdy_framer_unittest.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/spdy/buffered_spdy_framer.h" 5 #include "net/spdy/buffered_spdy_framer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 void BufferedSpdyFramer::OnSettingsEnd() { 141 void BufferedSpdyFramer::OnSettingsEnd() {
142 visitor_->OnSettingsEnd(); 142 visitor_->OnSettingsEnd();
143 } 143 }
144 144
145 void BufferedSpdyFramer::OnPing(SpdyPingId unique_id, bool is_ack) { 145 void BufferedSpdyFramer::OnPing(SpdyPingId unique_id, bool is_ack) {
146 visitor_->OnPing(unique_id, is_ack); 146 visitor_->OnPing(unique_id, is_ack);
147 } 147 }
148 148
149 void BufferedSpdyFramer::OnRstStream(SpdyStreamId stream_id, 149 void BufferedSpdyFramer::OnRstStream(SpdyStreamId stream_id,
150 SpdyRstStreamStatus status) { 150 SpdyErrorCode error_code) {
151 visitor_->OnRstStream(stream_id, status); 151 visitor_->OnRstStream(stream_id, error_code);
152 } 152 }
153 void BufferedSpdyFramer::OnGoAway(SpdyStreamId last_accepted_stream_id, 153 void BufferedSpdyFramer::OnGoAway(SpdyStreamId last_accepted_stream_id,
154 SpdyGoAwayStatus status) { 154 SpdyErrorCode error_code) {
155 DCHECK(!goaway_fields_); 155 DCHECK(!goaway_fields_);
156 goaway_fields_.reset(new GoAwayFields()); 156 goaway_fields_.reset(new GoAwayFields());
157 goaway_fields_->last_accepted_stream_id = last_accepted_stream_id; 157 goaway_fields_->last_accepted_stream_id = last_accepted_stream_id;
158 goaway_fields_->status = status; 158 goaway_fields_->error_code = error_code;
159 } 159 }
160 160
161 bool BufferedSpdyFramer::OnGoAwayFrameData(const char* goaway_data, 161 bool BufferedSpdyFramer::OnGoAwayFrameData(const char* goaway_data,
162 size_t len) { 162 size_t len) {
163 if (len > 0) { 163 if (len > 0) {
164 if (goaway_fields_->debug_data.size() < kGoAwayDebugDataMaxSize) { 164 if (goaway_fields_->debug_data.size() < kGoAwayDebugDataMaxSize) {
165 goaway_fields_->debug_data.append( 165 goaway_fields_->debug_data.append(
166 goaway_data, std::min(len, kGoAwayDebugDataMaxSize - 166 goaway_data, std::min(len, kGoAwayDebugDataMaxSize -
167 goaway_fields_->debug_data.size())); 167 goaway_fields_->debug_data.size()));
168 } 168 }
169 return true; 169 return true;
170 } 170 }
171 visitor_->OnGoAway(goaway_fields_->last_accepted_stream_id, 171 visitor_->OnGoAway(goaway_fields_->last_accepted_stream_id,
172 goaway_fields_->status, goaway_fields_->debug_data); 172 goaway_fields_->error_code, goaway_fields_->debug_data);
173 goaway_fields_.reset(); 173 goaway_fields_.reset();
174 return true; 174 return true;
175 } 175 }
176 176
177 void BufferedSpdyFramer::OnWindowUpdate(SpdyStreamId stream_id, 177 void BufferedSpdyFramer::OnWindowUpdate(SpdyStreamId stream_id,
178 int delta_window_size) { 178 int delta_window_size) {
179 visitor_->OnWindowUpdate(stream_id, delta_window_size); 179 visitor_->OnWindowUpdate(stream_id, delta_window_size);
180 } 180 }
181 181
182 void BufferedSpdyFramer::OnPushPromise(SpdyStreamId stream_id, 182 void BufferedSpdyFramer::OnPushPromise(SpdyStreamId stream_id,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 233
234 bool BufferedSpdyFramer::HasError() { 234 bool BufferedSpdyFramer::HasError() {
235 return spdy_framer_.HasError(); 235 return spdy_framer_.HasError();
236 } 236 }
237 237
238 // TODO(jgraettinger): Eliminate uses of this method (prefer 238 // TODO(jgraettinger): Eliminate uses of this method (prefer
239 // SpdyRstStreamIR). 239 // SpdyRstStreamIR).
240 SpdySerializedFrame* BufferedSpdyFramer::CreateRstStream( 240 SpdySerializedFrame* BufferedSpdyFramer::CreateRstStream(
241 SpdyStreamId stream_id, 241 SpdyStreamId stream_id,
242 SpdyRstStreamStatus status) const { 242 SpdyErrorCode error_code) const {
243 SpdyRstStreamIR rst_ir(stream_id, status); 243 SpdyRstStreamIR rst_ir(stream_id, error_code);
244 return new SpdySerializedFrame(spdy_framer_.SerializeRstStream(rst_ir)); 244 return new SpdySerializedFrame(spdy_framer_.SerializeRstStream(rst_ir));
245 } 245 }
246 246
247 // TODO(jgraettinger): Eliminate uses of this method (prefer 247 // TODO(jgraettinger): Eliminate uses of this method (prefer
248 // SpdySettingsIR). 248 // SpdySettingsIR).
249 SpdySerializedFrame* BufferedSpdyFramer::CreateSettings( 249 SpdySerializedFrame* BufferedSpdyFramer::CreateSettings(
250 const SettingsMap& values) const { 250 const SettingsMap& values) const {
251 SpdySettingsIR settings_ir; 251 SpdySettingsIR settings_ir;
252 for (SettingsMap::const_iterator it = values.begin(); it != values.end(); 252 for (SettingsMap::const_iterator it = values.begin(); it != values.end();
253 ++it) { 253 ++it) {
254 settings_ir.AddSetting(it->first, it->second); 254 settings_ir.AddSetting(it->first, it->second);
255 } 255 }
256 return new SpdySerializedFrame(spdy_framer_.SerializeSettings(settings_ir)); 256 return new SpdySerializedFrame(spdy_framer_.SerializeSettings(settings_ir));
257 } 257 }
258 258
259 // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyPingIR). 259 // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyPingIR).
260 SpdySerializedFrame* BufferedSpdyFramer::CreatePingFrame(SpdyPingId unique_id, 260 SpdySerializedFrame* BufferedSpdyFramer::CreatePingFrame(SpdyPingId unique_id,
261 bool is_ack) const { 261 bool is_ack) const {
262 SpdyPingIR ping_ir(unique_id); 262 SpdyPingIR ping_ir(unique_id);
263 ping_ir.set_is_ack(is_ack); 263 ping_ir.set_is_ack(is_ack);
264 return new SpdySerializedFrame(spdy_framer_.SerializePing(ping_ir)); 264 return new SpdySerializedFrame(spdy_framer_.SerializePing(ping_ir));
265 } 265 }
266 266
267 // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyGoAwayIR). 267 // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyGoAwayIR).
268 SpdySerializedFrame* BufferedSpdyFramer::CreateGoAway( 268 SpdySerializedFrame* BufferedSpdyFramer::CreateGoAway(
269 SpdyStreamId last_accepted_stream_id, 269 SpdyStreamId last_accepted_stream_id,
270 SpdyGoAwayStatus status, 270 SpdyErrorCode error_code,
271 base::StringPiece debug_data) const { 271 base::StringPiece debug_data) const {
272 SpdyGoAwayIR go_ir(last_accepted_stream_id, status, debug_data); 272 SpdyGoAwayIR go_ir(last_accepted_stream_id, error_code, debug_data);
273 return new SpdySerializedFrame(spdy_framer_.SerializeGoAway(go_ir)); 273 return new SpdySerializedFrame(spdy_framer_.SerializeGoAway(go_ir));
274 } 274 }
275 275
276 // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyHeadersIR). 276 // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyHeadersIR).
277 SpdySerializedFrame* BufferedSpdyFramer::CreateHeaders( 277 SpdySerializedFrame* BufferedSpdyFramer::CreateHeaders(
278 SpdyStreamId stream_id, 278 SpdyStreamId stream_id,
279 SpdyControlFlags flags, 279 SpdyControlFlags flags,
280 int weight, 280 int weight,
281 SpdyHeaderBlock headers) { 281 SpdyHeaderBlock headers) {
282 SpdyHeadersIR headers_ir(stream_id, std::move(headers)); 282 SpdyHeadersIR headers_ir(stream_id, std::move(headers));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 335 }
336 336
337 void BufferedSpdyFramer::InitHeaderStreaming(SpdyStreamId stream_id) { 337 void BufferedSpdyFramer::InitHeaderStreaming(SpdyStreamId stream_id) {
338 header_buffer_.clear(); 338 header_buffer_.clear();
339 header_buffer_valid_ = true; 339 header_buffer_valid_ = true;
340 header_stream_id_ = stream_id; 340 header_stream_id_ = stream_id;
341 DCHECK_NE(header_stream_id_, SpdyFramer::kInvalidStream); 341 DCHECK_NE(header_stream_id_, SpdyFramer::kInvalidStream);
342 } 342 }
343 343
344 } // namespace net 344 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/buffered_spdy_framer.h ('k') | net/spdy/buffered_spdy_framer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698