| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 v3_dictionary_id(CalculateDictionaryId(kV3Dictionary, kV3DictionarySize)) | 44 v3_dictionary_id(CalculateDictionaryId(kV3Dictionary, kV3DictionarySize)) |
| 45 {} | 45 {} |
| 46 const uLong v2_dictionary_id; | 46 const uLong v2_dictionary_id; |
| 47 const uLong v3_dictionary_id; | 47 const uLong v3_dictionary_id; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Adler ID for the SPDY header compressor dictionaries. Note that they are | 50 // Adler ID for the SPDY header compressor dictionaries. Note that they are |
| 51 // initialized lazily to avoid static initializers. | 51 // initialized lazily to avoid static initializers. |
| 52 base::LazyInstance<DictionaryIds>::Leaky g_dictionary_ids; | 52 base::LazyInstance<DictionaryIds>::Leaky g_dictionary_ids; |
| 53 | 53 |
| 54 // By default is compression on or off. | |
| 55 bool g_enable_compression_default = true; | |
| 56 | |
| 57 } // namespace | 54 } // namespace |
| 58 | 55 |
| 59 const int SpdyFramer::kMinSpdyVersion = 2; | 56 const int SpdyFramer::kMinSpdyVersion = 2; |
| 60 const int SpdyFramer::kMaxSpdyVersion = 3; | 57 const int SpdyFramer::kMaxSpdyVersion = 3; |
| 61 const SpdyStreamId SpdyFramer::kInvalidStream = -1; | 58 const SpdyStreamId SpdyFramer::kInvalidStream = -1; |
| 62 const size_t SpdyFramer::kHeaderDataChunkMaxSize = 1024; | 59 const size_t SpdyFramer::kHeaderDataChunkMaxSize = 1024; |
| 63 const size_t SpdyFramer::kControlFrameBufferSize = | 60 const size_t SpdyFramer::kControlFrameBufferSize = |
| 64 sizeof(SpdySynStreamControlFrameBlock); | 61 sizeof(SpdySynStreamControlFrameBlock); |
| 65 const size_t SpdyFramer::kMaxControlFrameSize = 16 * 1024; | 62 const size_t SpdyFramer::kMaxControlFrameSize = 16 * 1024; |
| 66 | 63 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 SpdyCredential::~SpdyCredential() {} | 119 SpdyCredential::~SpdyCredential() {} |
| 123 | 120 |
| 124 SpdyFramer::SpdyFramer(int version) | 121 SpdyFramer::SpdyFramer(int version) |
| 125 : state_(SPDY_RESET), | 122 : state_(SPDY_RESET), |
| 126 error_code_(SPDY_NO_ERROR), | 123 error_code_(SPDY_NO_ERROR), |
| 127 remaining_data_(0), | 124 remaining_data_(0), |
| 128 remaining_control_payload_(0), | 125 remaining_control_payload_(0), |
| 129 remaining_control_header_(0), | 126 remaining_control_header_(0), |
| 130 current_frame_buffer_(new char[kControlFrameBufferSize]), | 127 current_frame_buffer_(new char[kControlFrameBufferSize]), |
| 131 current_frame_len_(0), | 128 current_frame_len_(0), |
| 132 enable_compression_(g_enable_compression_default), | 129 enable_compression_(true), |
| 133 visitor_(NULL), | 130 visitor_(NULL), |
| 134 display_protocol_("SPDY"), | 131 display_protocol_("SPDY"), |
| 135 spdy_version_(version), | 132 spdy_version_(version), |
| 136 syn_frame_processed_(false), | 133 syn_frame_processed_(false), |
| 137 probable_http_response_(false) { | 134 probable_http_response_(false) { |
| 138 DCHECK_GE(kMaxSpdyVersion, version); | 135 DCHECK_GE(kMaxSpdyVersion, version); |
| 139 DCHECK_LE(kMinSpdyVersion, version); | 136 DCHECK_LE(kMinSpdyVersion, version); |
| 140 } | 137 } |
| 141 | 138 |
| 142 SpdyFramer::~SpdyFramer() { | 139 SpdyFramer::~SpdyFramer() { |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 break; | 1623 break; |
| 1627 } | 1624 } |
| 1628 } | 1625 } |
| 1629 return stream_id; | 1626 return stream_id; |
| 1630 } | 1627 } |
| 1631 | 1628 |
| 1632 void SpdyFramer::set_enable_compression(bool value) { | 1629 void SpdyFramer::set_enable_compression(bool value) { |
| 1633 enable_compression_ = value; | 1630 enable_compression_ = value; |
| 1634 } | 1631 } |
| 1635 | 1632 |
| 1636 void SpdyFramer::set_enable_compression_default(bool value) { | |
| 1637 g_enable_compression_default = value; | |
| 1638 } | |
| 1639 | |
| 1640 } // namespace net | 1633 } // namespace net |
| OLD | NEW |