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

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

Issue 1801293002: Lint SpdySession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/spdy/spdy_session.h ('k') | no next file » | 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_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 for (size_t i = 0; i < N; ++i) { 331 for (size_t i = 0; i < N; ++i) {
332 total_size += arr[i].size(); 332 total_size += arr[i].size();
333 } 333 }
334 return total_size; 334 return total_size;
335 } 335 }
336 336
337 // Helper class for std:find_if on STL container containing 337 // Helper class for std:find_if on STL container containing
338 // SpdyStreamRequest weak pointers. 338 // SpdyStreamRequest weak pointers.
339 class RequestEquals { 339 class RequestEquals {
340 public: 340 public:
341 RequestEquals(const base::WeakPtr<SpdyStreamRequest>& request) 341 explicit RequestEquals(const base::WeakPtr<SpdyStreamRequest>& request)
342 : request_(request) {} 342 : request_(request) {}
343 343
344 bool operator()(const base::WeakPtr<SpdyStreamRequest>& request) const { 344 bool operator()(const base::WeakPtr<SpdyStreamRequest>& request) const {
345 return request_.get() == request.get(); 345 return request_.get() == request.get();
346 } 346 }
347 347
348 private: 348 private:
349 const base::WeakPtr<SpdyStreamRequest> request_; 349 const base::WeakPtr<SpdyStreamRequest> request_;
350 }; 350 };
351 351
352 // The maximum number of concurrent streams we will ever create. Even if 352 // The maximum number of concurrent streams we will ever create. Even if
353 // the server permits more, we will never exceed this limit. 353 // the server permits more, we will never exceed this limit.
354 const size_t kMaxConcurrentStreamLimit = 256; 354 const size_t kMaxConcurrentStreamLimit = 256;
355 355
356 } // namespace 356 } // namespace
357 357
358 SpdyProtocolErrorDetails MapFramerErrorToProtocolError( 358 SpdyProtocolErrorDetails MapFramerErrorToProtocolError(
359 SpdyFramer::SpdyError err) { 359 SpdyFramer::SpdyError err) {
360 switch(err) { 360 switch (err) {
361 case SpdyFramer::SPDY_NO_ERROR: 361 case SpdyFramer::SPDY_NO_ERROR:
362 return SPDY_ERROR_NO_ERROR; 362 return SPDY_ERROR_NO_ERROR;
363 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME: 363 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME:
364 return SPDY_ERROR_INVALID_CONTROL_FRAME; 364 return SPDY_ERROR_INVALID_CONTROL_FRAME;
365 case SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE: 365 case SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE:
366 return SPDY_ERROR_CONTROL_PAYLOAD_TOO_LARGE; 366 return SPDY_ERROR_CONTROL_PAYLOAD_TOO_LARGE;
367 case SpdyFramer::SPDY_ZLIB_INIT_FAILURE: 367 case SpdyFramer::SPDY_ZLIB_INIT_FAILURE:
368 return SPDY_ERROR_ZLIB_INIT_FAILURE; 368 return SPDY_ERROR_ZLIB_INIT_FAILURE;
369 case SpdyFramer::SPDY_UNSUPPORTED_VERSION: 369 case SpdyFramer::SPDY_UNSUPPORTED_VERSION:
370 return SPDY_ERROR_UNSUPPORTED_VERSION; 370 return SPDY_ERROR_UNSUPPORTED_VERSION;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 case SpdyFramer::SPDY_UNEXPECTED_FRAME: 415 case SpdyFramer::SPDY_UNEXPECTED_FRAME:
416 return ERR_SPDY_PROTOCOL_ERROR; 416 return ERR_SPDY_PROTOCOL_ERROR;
417 default: 417 default:
418 NOTREACHED(); 418 NOTREACHED();
419 return ERR_SPDY_PROTOCOL_ERROR; 419 return ERR_SPDY_PROTOCOL_ERROR;
420 } 420 }
421 } 421 }
422 422
423 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( 423 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError(
424 SpdyRstStreamStatus status) { 424 SpdyRstStreamStatus status) {
425 switch(status) { 425 switch (status) {
426 case RST_STREAM_PROTOCOL_ERROR: 426 case RST_STREAM_PROTOCOL_ERROR:
427 return STATUS_CODE_PROTOCOL_ERROR; 427 return STATUS_CODE_PROTOCOL_ERROR;
428 case RST_STREAM_INVALID_STREAM: 428 case RST_STREAM_INVALID_STREAM:
429 return STATUS_CODE_INVALID_STREAM; 429 return STATUS_CODE_INVALID_STREAM;
430 case RST_STREAM_REFUSED_STREAM: 430 case RST_STREAM_REFUSED_STREAM:
431 return STATUS_CODE_REFUSED_STREAM; 431 return STATUS_CODE_REFUSED_STREAM;
432 case RST_STREAM_UNSUPPORTED_VERSION: 432 case RST_STREAM_UNSUPPORTED_VERSION:
433 return STATUS_CODE_UNSUPPORTED_VERSION; 433 return STATUS_CODE_UNSUPPORTED_VERSION;
434 case RST_STREAM_CANCEL: 434 case RST_STREAM_CANCEL:
435 return STATUS_CODE_CANCEL; 435 return STATUS_CODE_CANCEL;
(...skipping 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 if (!queue->empty()) { 3354 if (!queue->empty()) {
3355 SpdyStreamId stream_id = queue->front(); 3355 SpdyStreamId stream_id = queue->front();
3356 queue->pop_front(); 3356 queue->pop_front();
3357 return stream_id; 3357 return stream_id;
3358 } 3358 }
3359 } 3359 }
3360 return 0; 3360 return 0;
3361 } 3361 }
3362 3362
3363 } // namespace net 3363 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698