Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: net/spdy/spdy_framer.cc

Issue 263033007: SPDY: Remove redundant end_push_promise and end_headers fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_frame_builder_test.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 return builder.take(); 2400 return builder.take();
2401 } 2401 }
2402 2402
2403 SpdySerializedFrame* SpdyFramer::SerializeHeaders( 2403 SpdySerializedFrame* SpdyFramer::SerializeHeaders(
2404 const SpdyHeadersIR& headers) { 2404 const SpdyHeadersIR& headers) {
2405 uint8 flags = 0; 2405 uint8 flags = 0;
2406 if (headers.fin()) { 2406 if (headers.fin()) {
2407 flags |= CONTROL_FLAG_FIN; 2407 flags |= CONTROL_FLAG_FIN;
2408 } 2408 }
2409 if (protocol_version() > SPDY3) { 2409 if (protocol_version() > SPDY3) {
2410 // TODO(mlavan): If we overflow into a CONTINUATION frame, this will 2410 // This will get overwritten if we overflow into a CONTINUATION frame.
2411 // get overwritten below, so we should probably just get rid of the 2411 flags |= HEADERS_FLAG_END_HEADERS;
2412 // end_headers field.
2413 if (headers.end_headers()) {
2414 flags |= HEADERS_FLAG_END_HEADERS;
2415 }
2416 if (headers.has_priority()) { 2412 if (headers.has_priority()) {
2417 flags |= HEADERS_FLAG_PRIORITY; 2413 flags |= HEADERS_FLAG_PRIORITY;
2418 } 2414 }
2419 } 2415 }
2420 2416
2421 // The size of this frame, including variable-length name-value block. 2417 // The size of this frame, including variable-length name-value block.
2422 size_t size = GetHeadersMinimumSize(); 2418 size_t size = GetHeadersMinimumSize();
2423 2419
2424 uint32 priority = headers.priority(); 2420 uint32 priority = headers.priority();
2425 if (headers.has_priority()) { 2421 if (headers.has_priority()) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 DCHECK_LT(SPDY3, protocol_version()); 2507 DCHECK_LT(SPDY3, protocol_version());
2512 SpdyFrameBuilder builder(GetBlockedSize(), protocol_version()); 2508 SpdyFrameBuilder builder(GetBlockedSize(), protocol_version());
2513 builder.BeginNewFrame(*this, BLOCKED, kNoFlags, blocked.stream_id()); 2509 builder.BeginNewFrame(*this, BLOCKED, kNoFlags, blocked.stream_id());
2514 return builder.take(); 2510 return builder.take();
2515 } 2511 }
2516 2512
2517 SpdyFrame* SpdyFramer::SerializePushPromise( 2513 SpdyFrame* SpdyFramer::SerializePushPromise(
2518 const SpdyPushPromiseIR& push_promise) { 2514 const SpdyPushPromiseIR& push_promise) {
2519 DCHECK_LT(SPDY3, protocol_version()); 2515 DCHECK_LT(SPDY3, protocol_version());
2520 uint8 flags = 0; 2516 uint8 flags = 0;
2521 // TODO(mlavan): If we overflow into a CONTINUATION frame, this will 2517 // This will get overwritten if we overflow into a CONTINUATION frame.
2522 // get overwritten below, so we should probably just get rid of the 2518 flags |= PUSH_PROMISE_FLAG_END_PUSH_PROMISE;
2523 // end_push_promise field.
2524 if (push_promise.end_push_promise()) {
2525 flags |= PUSH_PROMISE_FLAG_END_PUSH_PROMISE;
2526 }
2527 // The size of this frame, including variable-length name-value block. 2519 // The size of this frame, including variable-length name-value block.
2528 size_t size = GetPushPromiseMinimumSize(); 2520 size_t size = GetPushPromiseMinimumSize();
2529 2521
2530 string hpack_encoding; 2522 string hpack_encoding;
2531 if (protocol_version() > SPDY3) { 2523 if (protocol_version() > SPDY3) {
2532 if (enable_compression_) { 2524 if (enable_compression_) {
2533 hpack_encoder_.EncodeHeaderSet( 2525 hpack_encoder_.EncodeHeaderSet(
2534 push_promise.name_value_block(), &hpack_encoding); 2526 push_promise.name_value_block(), &hpack_encoding);
2535 } else { 2527 } else {
2536 hpack_encoder_.EncodeHeaderSetWithoutCompression( 2528 hpack_encoder_.EncodeHeaderSetWithoutCompression(
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 builder->Seek(compressed_size); 2983 builder->Seek(compressed_size);
2992 builder->RewriteLength(*this); 2984 builder->RewriteLength(*this);
2993 2985
2994 pre_compress_bytes.Add(uncompressed_len); 2986 pre_compress_bytes.Add(uncompressed_len);
2995 post_compress_bytes.Add(compressed_size); 2987 post_compress_bytes.Add(compressed_size);
2996 2988
2997 compressed_frames.Increment(); 2989 compressed_frames.Increment();
2998 } 2990 }
2999 2991
3000 } // namespace net 2992 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_frame_builder_test.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698