| 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 #include <utility> |
| 10 | 10 |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" |
| 14 | 15 |
| 15 #if defined(COMPILER_GCC) | 16 #if defined(COMPILER_GCC) |
| 16 #define PRETTY_THIS base::StringPrintf("%s@%p ", __PRETTY_FUNCTION__, this) | 17 #define PRETTY_THIS base::StringPrintf("%s@%p ", __PRETTY_FUNCTION__, this) |
| 17 #elif defined(COMPILER_MSVC) | 18 #elif defined(COMPILER_MSVC) |
| 18 #define PRETTY_THIS base::StringPrintf("%s@%p ", __FUNCSIG__, this) | 19 #define PRETTY_THIS base::StringPrintf("%s@%p ", __FUNCSIG__, this) |
| 19 #else | 20 #else |
| 20 #define PRETTY_THIS base::StringPrintf("%s@%p ", __func__, this) | 21 #define PRETTY_THIS base::StringPrintf("%s@%p ", __func__, this) |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 225 |
| 225 void Reset() override { framer_.Reset(); } | 226 void Reset() override { framer_.Reset(); } |
| 226 | 227 |
| 227 SpdyFramer::SpdyFramerError spdy_framer_error() const override { | 228 SpdyFramer::SpdyFramerError spdy_framer_error() const override { |
| 228 return framer_.spdy_framer_error(); | 229 return framer_.spdy_framer_error(); |
| 229 } | 230 } |
| 230 SpdyFramer::SpdyState state() const override { return framer_.state(); } | 231 SpdyFramer::SpdyState state() const override { return framer_.state(); } |
| 231 bool probable_http_response() const override { | 232 bool probable_http_response() const override { |
| 232 return framer_.probable_http_response(); | 233 return framer_.probable_http_response(); |
| 233 } | 234 } |
| 235 size_t EstimateMemoryUsage() const override { |
| 236 // Skip |visitor_adapter_| because it doesn't allocate. |
| 237 return SpdyEstimateMemoryUsage(framer_); |
| 238 } |
| 234 | 239 |
| 235 private: | 240 private: |
| 236 SpdyFramer framer_; | 241 SpdyFramer framer_; |
| 237 SpdyFramer* const outer_; | 242 SpdyFramer* const outer_; |
| 238 std::unique_ptr<SpdyFramerVisitorAdapter> visitor_adapter_; | 243 std::unique_ptr<SpdyFramerVisitorAdapter> visitor_adapter_; |
| 239 }; | 244 }; |
| 240 | 245 |
| 241 std::unique_ptr<SpdyFramerDecoderAdapter> CreateNestedSpdyFramerDecoder( | 246 std::unique_ptr<SpdyFramerDecoderAdapter> CreateNestedSpdyFramerDecoder( |
| 242 SpdyFramer* outer) { | 247 SpdyFramer* outer) { |
| 243 return std::unique_ptr<SpdyFramerDecoderAdapter>( | 248 return std::unique_ptr<SpdyFramerDecoderAdapter>( |
| 244 new NestedSpdyFramerDecoder(outer)); | 249 new NestedSpdyFramerDecoder(outer)); |
| 245 } | 250 } |
| 246 | 251 |
| 247 } // namespace net | 252 } // namespace net |
| OLD | NEW |