| 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 #include "net/spdy/spdy_framer.h" | 5 #include "net/spdy/spdy_framer.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cctype> | 10 #include <cctype> |
| 11 #include <ios> | 11 #include <ios> |
| 12 #include <iterator> | 12 #include <iterator> |
| 13 #include <list> | 13 #include <list> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <new> | 15 #include <new> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 22 #include "base/metrics/histogram_macros.h" | 22 #include "base/metrics/histogram_macros.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "net/quic/core/quic_flags.h" | 24 #include "net/quic/core/quic_flags.h" |
| 25 #include "net/spdy/hpack/hpack_constants.h" | 25 #include "net/spdy/hpack/hpack_constants.h" |
| 26 #include "net/spdy/hpack/hpack_decoder.h" | 26 #include "net/spdy/hpack/hpack_decoder.h" |
| 27 #include "net/spdy/hpack/hpack_decoder2.h" | 27 #include "net/spdy/hpack/hpack_decoder2.h" |
| 28 #include "net/spdy/hpack/hpack_decoder3.h" |
| 28 #include "net/spdy/http2_frame_decoder_adapter.h" | 29 #include "net/spdy/http2_frame_decoder_adapter.h" |
| 29 #include "net/spdy/spdy_bitmasks.h" | 30 #include "net/spdy/spdy_bitmasks.h" |
| 30 #include "net/spdy/spdy_bug_tracker.h" | 31 #include "net/spdy/spdy_bug_tracker.h" |
| 31 #include "net/spdy/spdy_flags.h" | 32 #include "net/spdy/spdy_flags.h" |
| 32 #include "net/spdy/spdy_frame_builder.h" | 33 #include "net/spdy/spdy_frame_builder.h" |
| 33 #include "net/spdy/spdy_frame_reader.h" | 34 #include "net/spdy/spdy_frame_reader.h" |
| 34 #include "net/spdy/spdy_framer_decoder_adapter.h" | 35 #include "net/spdy/spdy_framer_decoder_adapter.h" |
| 35 #include "net/spdy/spdy_headers_block_parser.h" | 36 #include "net/spdy/spdy_headers_block_parser.h" |
| 36 | 37 |
| 37 using base::StringPiece; | 38 using base::StringPiece; |
| (...skipping 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 hpack_encoder_.reset(new HpackEncoder(ObtainHpackHuffmanTable())); | 2465 hpack_encoder_.reset(new HpackEncoder(ObtainHpackHuffmanTable())); |
| 2465 if (!compression_enabled()) { | 2466 if (!compression_enabled()) { |
| 2466 hpack_encoder_->DisableCompression(); | 2467 hpack_encoder_->DisableCompression(); |
| 2467 } | 2468 } |
| 2468 } | 2469 } |
| 2469 return hpack_encoder_.get(); | 2470 return hpack_encoder_.get(); |
| 2470 } | 2471 } |
| 2471 | 2472 |
| 2472 HpackDecoderInterface* SpdyFramer::GetHpackDecoder() { | 2473 HpackDecoderInterface* SpdyFramer::GetHpackDecoder() { |
| 2473 if (hpack_decoder_.get() == nullptr) { | 2474 if (hpack_decoder_.get() == nullptr) { |
| 2474 if (FLAGS_chromium_http2_flag_spdy_use_hpack_decoder2) { | 2475 if (FLAGS_chromium_http2_flag_spdy_use_hpack_decoder3) { |
| 2476 SPDY_BUG_IF(FLAGS_chromium_http2_flag_spdy_use_hpack_decoder2) |
| 2477 << "Both alternate decoders are enabled."; |
| 2478 hpack_decoder_.reset(new HpackDecoder3()); |
| 2479 } else if (FLAGS_chromium_http2_flag_spdy_use_hpack_decoder2) { |
| 2475 hpack_decoder_.reset(new HpackDecoder2()); | 2480 hpack_decoder_.reset(new HpackDecoder2()); |
| 2476 } else { | 2481 } else { |
| 2477 hpack_decoder_.reset(new HpackDecoder()); | 2482 hpack_decoder_.reset(new HpackDecoder()); |
| 2478 } | 2483 } |
| 2479 } | 2484 } |
| 2480 return hpack_decoder_.get(); | 2485 return hpack_decoder_.get(); |
| 2481 } | 2486 } |
| 2482 | 2487 |
| 2483 bool SpdyFramer::IncrementallyDeliverControlFrameHeaderData( | 2488 bool SpdyFramer::IncrementallyDeliverControlFrameHeaderData( |
| 2484 SpdyStreamId stream_id, const char* data, size_t len) { | 2489 SpdyStreamId stream_id, const char* data, size_t len) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 builder->WriteUInt32(header_block.size()); | 2543 builder->WriteUInt32(header_block.size()); |
| 2539 | 2544 |
| 2540 // Serialize each header. | 2545 // Serialize each header. |
| 2541 for (const auto& header : header_block) { | 2546 for (const auto& header : header_block) { |
| 2542 builder->WriteStringPiece32(base::ToLowerASCII(header.first)); | 2547 builder->WriteStringPiece32(base::ToLowerASCII(header.first)); |
| 2543 builder->WriteStringPiece32(header.second); | 2548 builder->WriteStringPiece32(header.second); |
| 2544 } | 2549 } |
| 2545 } | 2550 } |
| 2546 | 2551 |
| 2547 } // namespace net | 2552 } // namespace net |
| OLD | NEW |