| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_decoder_adapter.h" | 5 #include "net/spdy/spdy_framer_decoder_adapter.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 | 14 |
| 14 #if defined(COMPILER_GCC) | 15 #if defined(COMPILER_GCC) |
| 15 #define PRETTY_THIS base::StringPrintf("%s@%p ", __PRETTY_FUNCTION__, this) | 16 #define PRETTY_THIS base::StringPrintf("%s@%p ", __PRETTY_FUNCTION__, this) |
| 16 #elif defined(COMPILER_MSVC) | 17 #elif defined(COMPILER_MSVC) |
| 17 #define PRETTY_THIS base::StringPrintf("%s@%p ", __FUNCSIG__, this) | 18 #define PRETTY_THIS base::StringPrintf("%s@%p ", __FUNCSIG__, this) |
| 18 #else | 19 #else |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 227 } |
| 227 | 228 |
| 228 // Passes the call on to the base adapter class and wrapped SpdyFramer. | 229 // Passes the call on to the base adapter class and wrapped SpdyFramer. |
| 229 void set_process_single_input_frame(bool v) override { | 230 void set_process_single_input_frame(bool v) override { |
| 230 SpdyFramerDecoderAdapter::set_process_single_input_frame(v); | 231 SpdyFramerDecoderAdapter::set_process_single_input_frame(v); |
| 231 framer_.set_process_single_input_frame(v); | 232 framer_.set_process_single_input_frame(v); |
| 232 } | 233 } |
| 233 | 234 |
| 234 size_t ProcessInput(const char* data, size_t len) override { | 235 size_t ProcessInput(const char* data, size_t len) override { |
| 235 DVLOG(2) << "ProcessInput(data, " << len << ")"; | 236 DVLOG(2) << "ProcessInput(data, " << len << ")"; |
| 236 const bool use_new_methods = outer_->use_new_methods_for_test(); | |
| 237 if (framer_.use_new_methods_for_test() != use_new_methods) { | |
| 238 DVLOG(1) << "Overriding use_new_methods_ in nested framer, setting=" | |
| 239 << (use_new_methods ? "true" : "false"); | |
| 240 framer_.set_use_new_methods_for_test(use_new_methods); | |
| 241 } | |
| 242 size_t result = framer_.ProcessInput(data, len); | 237 size_t result = framer_.ProcessInput(data, len); |
| 243 DVLOG(2) << "ProcessInput(data, " << len << ") returning " << result; | 238 DVLOG(2) << "ProcessInput(data, " << len << ") returning " << result; |
| 244 return result; | 239 return result; |
| 245 } | 240 } |
| 246 | 241 |
| 247 void Reset() override { framer_.Reset(); } | 242 void Reset() override { framer_.Reset(); } |
| 248 | 243 |
| 249 SpdyFramer::SpdyError error_code() const override { | 244 SpdyFramer::SpdyError error_code() const override { |
| 250 return framer_.error_code(); | 245 return framer_.error_code(); |
| 251 } | 246 } |
| 252 SpdyFramer::SpdyState state() const override { return framer_.state(); } | 247 SpdyFramer::SpdyState state() const override { return framer_.state(); } |
| 253 bool probable_http_response() const override { | 248 bool probable_http_response() const override { |
| 254 return framer_.probable_http_response(); | 249 return framer_.probable_http_response(); |
| 255 } | 250 } |
| 256 | 251 |
| 257 private: | 252 private: |
| 258 SpdyFramer framer_; | 253 SpdyFramer framer_; |
| 259 SpdyFramer* const outer_; | 254 SpdyFramer* const outer_; |
| 260 std::unique_ptr<SpdyFramerVisitorAdapter> visitor_adapter_; | 255 std::unique_ptr<SpdyFramerVisitorAdapter> visitor_adapter_; |
| 261 }; | 256 }; |
| 262 | 257 |
| 263 std::unique_ptr<SpdyFramerDecoderAdapter> CreateNestedSpdyFramerDecoder( | 258 std::unique_ptr<SpdyFramerDecoderAdapter> CreateNestedSpdyFramerDecoder( |
| 264 SpdyFramer* outer) { | 259 SpdyFramer* outer) { |
| 265 return std::unique_ptr<SpdyFramerDecoderAdapter>( | 260 return std::unique_ptr<SpdyFramerDecoderAdapter>( |
| 266 new NestedSpdyFramerDecoder(outer)); | 261 new NestedSpdyFramerDecoder(outer)); |
| 267 } | 262 } |
| 268 | 263 |
| 269 } // namespace net | 264 } // namespace net |
| OLD | NEW |