| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
| 10 #include "base/third_party/valgrind/memcheck.h" | 10 #include "base/third_party/valgrind/memcheck.h" |
| (...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2840 | 2840 |
| 2841 namespace { | 2841 namespace { |
| 2842 | 2842 |
| 2843 class FrameSerializationVisitor : public SpdyFrameVisitor { | 2843 class FrameSerializationVisitor : public SpdyFrameVisitor { |
| 2844 public: | 2844 public: |
| 2845 explicit FrameSerializationVisitor(SpdyFramer* framer) : framer_(framer) {} | 2845 explicit FrameSerializationVisitor(SpdyFramer* framer) : framer_(framer) {} |
| 2846 virtual ~FrameSerializationVisitor() {} | 2846 virtual ~FrameSerializationVisitor() {} |
| 2847 | 2847 |
| 2848 SpdySerializedFrame* ReleaseSerializedFrame() { return frame_.release(); } | 2848 SpdySerializedFrame* ReleaseSerializedFrame() { return frame_.release(); } |
| 2849 | 2849 |
| 2850 virtual void VisitData(const SpdyDataIR& data) OVERRIDE { | 2850 virtual void VisitData(const SpdyDataIR& data) override { |
| 2851 frame_.reset(framer_->SerializeData(data)); | 2851 frame_.reset(framer_->SerializeData(data)); |
| 2852 } | 2852 } |
| 2853 virtual void VisitSynStream(const SpdySynStreamIR& syn_stream) OVERRIDE { | 2853 virtual void VisitSynStream(const SpdySynStreamIR& syn_stream) override { |
| 2854 frame_.reset(framer_->SerializeSynStream(syn_stream)); | 2854 frame_.reset(framer_->SerializeSynStream(syn_stream)); |
| 2855 } | 2855 } |
| 2856 virtual void VisitSynReply(const SpdySynReplyIR& syn_reply) OVERRIDE { | 2856 virtual void VisitSynReply(const SpdySynReplyIR& syn_reply) override { |
| 2857 frame_.reset(framer_->SerializeSynReply(syn_reply)); | 2857 frame_.reset(framer_->SerializeSynReply(syn_reply)); |
| 2858 } | 2858 } |
| 2859 virtual void VisitRstStream(const SpdyRstStreamIR& rst_stream) OVERRIDE { | 2859 virtual void VisitRstStream(const SpdyRstStreamIR& rst_stream) override { |
| 2860 frame_.reset(framer_->SerializeRstStream(rst_stream)); | 2860 frame_.reset(framer_->SerializeRstStream(rst_stream)); |
| 2861 } | 2861 } |
| 2862 virtual void VisitSettings(const SpdySettingsIR& settings) OVERRIDE { | 2862 virtual void VisitSettings(const SpdySettingsIR& settings) override { |
| 2863 frame_.reset(framer_->SerializeSettings(settings)); | 2863 frame_.reset(framer_->SerializeSettings(settings)); |
| 2864 } | 2864 } |
| 2865 virtual void VisitPing(const SpdyPingIR& ping) OVERRIDE { | 2865 virtual void VisitPing(const SpdyPingIR& ping) override { |
| 2866 frame_.reset(framer_->SerializePing(ping)); | 2866 frame_.reset(framer_->SerializePing(ping)); |
| 2867 } | 2867 } |
| 2868 virtual void VisitGoAway(const SpdyGoAwayIR& goaway) OVERRIDE { | 2868 virtual void VisitGoAway(const SpdyGoAwayIR& goaway) override { |
| 2869 frame_.reset(framer_->SerializeGoAway(goaway)); | 2869 frame_.reset(framer_->SerializeGoAway(goaway)); |
| 2870 } | 2870 } |
| 2871 virtual void VisitHeaders(const SpdyHeadersIR& headers) OVERRIDE { | 2871 virtual void VisitHeaders(const SpdyHeadersIR& headers) override { |
| 2872 frame_.reset(framer_->SerializeHeaders(headers)); | 2872 frame_.reset(framer_->SerializeHeaders(headers)); |
| 2873 } | 2873 } |
| 2874 virtual void VisitWindowUpdate( | 2874 virtual void VisitWindowUpdate( |
| 2875 const SpdyWindowUpdateIR& window_update) OVERRIDE { | 2875 const SpdyWindowUpdateIR& window_update) override { |
| 2876 frame_.reset(framer_->SerializeWindowUpdate(window_update)); | 2876 frame_.reset(framer_->SerializeWindowUpdate(window_update)); |
| 2877 } | 2877 } |
| 2878 virtual void VisitBlocked(const SpdyBlockedIR& blocked) OVERRIDE { | 2878 virtual void VisitBlocked(const SpdyBlockedIR& blocked) override { |
| 2879 frame_.reset(framer_->SerializeBlocked(blocked)); | 2879 frame_.reset(framer_->SerializeBlocked(blocked)); |
| 2880 } | 2880 } |
| 2881 virtual void VisitPushPromise( | 2881 virtual void VisitPushPromise( |
| 2882 const SpdyPushPromiseIR& push_promise) OVERRIDE { | 2882 const SpdyPushPromiseIR& push_promise) override { |
| 2883 frame_.reset(framer_->SerializePushPromise(push_promise)); | 2883 frame_.reset(framer_->SerializePushPromise(push_promise)); |
| 2884 } | 2884 } |
| 2885 virtual void VisitContinuation( | 2885 virtual void VisitContinuation( |
| 2886 const SpdyContinuationIR& continuation) OVERRIDE { | 2886 const SpdyContinuationIR& continuation) override { |
| 2887 frame_.reset(framer_->SerializeContinuation(continuation)); | 2887 frame_.reset(framer_->SerializeContinuation(continuation)); |
| 2888 } | 2888 } |
| 2889 virtual void VisitAltSvc(const SpdyAltSvcIR& altsvc) OVERRIDE { | 2889 virtual void VisitAltSvc(const SpdyAltSvcIR& altsvc) override { |
| 2890 frame_.reset(framer_->SerializeAltSvc(altsvc)); | 2890 frame_.reset(framer_->SerializeAltSvc(altsvc)); |
| 2891 } | 2891 } |
| 2892 virtual void VisitPriority(const SpdyPriorityIR& priority) OVERRIDE { | 2892 virtual void VisitPriority(const SpdyPriorityIR& priority) override { |
| 2893 frame_.reset(framer_->SerializePriority(priority)); | 2893 frame_.reset(framer_->SerializePriority(priority)); |
| 2894 } | 2894 } |
| 2895 | 2895 |
| 2896 private: | 2896 private: |
| 2897 SpdyFramer* framer_; | 2897 SpdyFramer* framer_; |
| 2898 scoped_ptr<SpdySerializedFrame> frame_; | 2898 scoped_ptr<SpdySerializedFrame> frame_; |
| 2899 }; | 2899 }; |
| 2900 | 2900 |
| 2901 } // namespace | 2901 } // namespace |
| 2902 | 2902 |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 builder->Seek(compressed_size); | 3247 builder->Seek(compressed_size); |
| 3248 builder->RewriteLength(*this); | 3248 builder->RewriteLength(*this); |
| 3249 | 3249 |
| 3250 pre_compress_bytes.Add(uncompressed_len); | 3250 pre_compress_bytes.Add(uncompressed_len); |
| 3251 post_compress_bytes.Add(compressed_size); | 3251 post_compress_bytes.Add(compressed_size); |
| 3252 | 3252 |
| 3253 compressed_frames.Increment(); | 3253 compressed_frames.Increment(); |
| 3254 } | 3254 } |
| 3255 | 3255 |
| 3256 } // namespace net | 3256 } // namespace net |
| OLD | NEW |