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 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 builder.WriteUInt8(static_cast<uint8>(altsvc.protocol_id().length())); | 2861 builder.WriteUInt8(static_cast<uint8>(altsvc.protocol_id().length())); |
2862 builder.WriteBytes(altsvc.protocol_id().data(), | 2862 builder.WriteBytes(altsvc.protocol_id().data(), |
2863 altsvc.protocol_id().length()); | 2863 altsvc.protocol_id().length()); |
2864 builder.WriteUInt8(static_cast<uint8>(altsvc.host().length())); | 2864 builder.WriteUInt8(static_cast<uint8>(altsvc.host().length())); |
2865 builder.WriteBytes(altsvc.host().data(), altsvc.host().length()); | 2865 builder.WriteBytes(altsvc.host().data(), altsvc.host().length()); |
2866 builder.WriteBytes(altsvc.origin().data(), altsvc.origin().length()); | 2866 builder.WriteBytes(altsvc.origin().data(), altsvc.origin().length()); |
2867 DCHECK_LT(GetAltSvcMinimumSize(), builder.length()); | 2867 DCHECK_LT(GetAltSvcMinimumSize(), builder.length()); |
2868 return builder.take(); | 2868 return builder.take(); |
2869 } | 2869 } |
2870 | 2870 |
2871 SpdyFrame* SpdyFramer::SerializePriority(const SpdyPriorityIR& priority) { | 2871 SpdyFrame* SpdyFramer::SerializePriority(const SpdyPriorityIR& priority) const { |
2872 DCHECK_LT(SPDY3, protocol_version()); | 2872 DCHECK_LT(SPDY3, protocol_version()); |
2873 size_t size = GetPrioritySize(); | 2873 size_t size = GetPrioritySize(); |
2874 | 2874 |
2875 SpdyFrameBuilder builder(size, protocol_version()); | 2875 SpdyFrameBuilder builder(size, protocol_version()); |
2876 builder.BeginNewFrame(*this, PRIORITY, kNoFlags, priority.stream_id()); | 2876 builder.BeginNewFrame(*this, PRIORITY, kNoFlags, priority.stream_id()); |
2877 | 2877 |
2878 // Make sure the highest-order bit in the parent stream id is zeroed out. | 2878 // Make sure the highest-order bit in the parent stream id is zeroed out. |
2879 uint32 parent_stream_id = priority.parent_stream_id() & 0x7fffffff; | 2879 uint32 parent_stream_id = priority.parent_stream_id() & 0x7fffffff; |
2880 uint32 exclusive = priority.exclusive() ? 0x80000000 : 0; | 2880 uint32 exclusive = priority.exclusive() ? 0x80000000 : 0; |
2881 // Set the one-bit exclusivity flag. | 2881 // Set the one-bit exclusivity flag. |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3291 builder->Seek(compressed_size); | 3291 builder->Seek(compressed_size); |
3292 builder->RewriteLength(*this); | 3292 builder->RewriteLength(*this); |
3293 | 3293 |
3294 pre_compress_bytes.Add(uncompressed_len); | 3294 pre_compress_bytes.Add(uncompressed_len); |
3295 post_compress_bytes.Add(compressed_size); | 3295 post_compress_bytes.Add(compressed_size); |
3296 | 3296 |
3297 compressed_frames.Increment(); | 3297 compressed_frames.Increment(); |
3298 } | 3298 } |
3299 | 3299 |
3300 } // namespace net | 3300 } // namespace net |
OLD | NEW |