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

Side by Side Diff: net/quic/quic_chromium_client_stream.cc

Issue 1961573002: Avoids the "re-encode HPACK as SPDY3" step. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update new test Created 4 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
« no previous file with comments | « net/quic/quic_chromium_client_stream.h ('k') | net/quic/quic_headers_stream.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/quic/quic_chromium_client_stream.h" 5 #include "net/quic/quic_chromium_client_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return; 53 return;
54 } 54 }
55 MarkHeadersConsumed(headers_len); 55 MarkHeadersConsumed(headers_len);
56 session_->OnInitialHeadersComplete(id(), headers); 56 session_->OnInitialHeadersComplete(id(), headers);
57 57
58 // The delegate will read the headers via a posted task. 58 // The delegate will read the headers via a posted task.
59 NotifyDelegateOfHeadersCompleteLater(headers, frame_len); 59 NotifyDelegateOfHeadersCompleteLater(headers, frame_len);
60 } 60 }
61 } 61 }
62 62
63 void QuicChromiumClientStream::OnInitialHeadersComplete(
64 bool fin,
65 size_t frame_len,
66 const QuicHeaderList& header_list) {
67 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list);
68
69 SpdyHeaderBlock header_block;
70 int64_t length = -1;
71 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &length, &header_block)) {
72 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString();
73 ConsumeHeaderList();
74 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
75 return;
76 }
77
78 ConsumeHeaderList();
79 session_->OnInitialHeadersComplete(id(), header_block);
80
81 // The delegate will read the headers via a posted task.
82 NotifyDelegateOfHeadersCompleteLater(header_block, frame_len);
83 }
84
85 void QuicChromiumClientStream::OnTrailingHeadersComplete(
86 bool fin,
87 size_t frame_len,
88 const QuicHeaderList& header_list) {
89 QuicSpdyStream::OnTrailingHeadersComplete(fin, frame_len, header_list);
90 NotifyDelegateOfHeadersCompleteLater(received_trailers(), frame_len);
91 }
92
63 void QuicChromiumClientStream::OnPromiseHeadersComplete( 93 void QuicChromiumClientStream::OnPromiseHeadersComplete(
64 QuicStreamId promised_id, 94 QuicStreamId promised_id,
65 size_t frame_len) { 95 size_t frame_len) {
66 size_t headers_len = decompressed_headers().length(); 96 size_t headers_len = decompressed_headers().length();
67 SpdyHeaderBlock headers; 97 SpdyHeaderBlock headers;
68 SpdyFramer framer(HTTP2); 98 SpdyFramer framer(HTTP2);
69 if (!framer.ParseHeaderBlockInBuffer(decompressed_headers().data(), 99 if (!framer.ParseHeaderBlockInBuffer(decompressed_headers().data(),
70 headers_len, &headers)) { 100 headers_len, &headers)) {
71 DLOG(WARNING) << "Invalid headers"; 101 DLOG(WARNING) << "Invalid headers";
72 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 102 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 245 }
216 246
217 void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete( 247 void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete(
218 SpdyHeaderBlock headers, 248 SpdyHeaderBlock headers,
219 size_t frame_len) { 249 size_t frame_len) {
220 if (!delegate_) 250 if (!delegate_)
221 return; 251 return;
222 // Only mark trailers consumed when we are about to notify delegate. 252 // Only mark trailers consumed when we are about to notify delegate.
223 if (headers_delivered_) { 253 if (headers_delivered_) {
224 MarkTrailersConsumed(decompressed_trailers().length()); 254 MarkTrailersConsumed(decompressed_trailers().length());
255 MarkTrailersDelivered();
225 net_log_.AddEvent( 256 net_log_.AddEvent(
226 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS, 257 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
227 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); 258 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
228 } else { 259 } else {
229 headers_delivered_ = true; 260 headers_delivered_ = true;
230 net_log_.AddEvent( 261 net_log_.AddEvent(
231 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS, 262 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
232 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); 263 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
233 } 264 }
234 265
(...skipping 17 matching lines...) Expand all
252 } else { 283 } else {
253 delegate_tasks_.push_back(closure); 284 delegate_tasks_.push_back(closure);
254 } 285 }
255 } 286 }
256 287
257 void QuicChromiumClientStream::DisableConnectionMigration() { 288 void QuicChromiumClientStream::DisableConnectionMigration() {
258 can_migrate_ = false; 289 can_migrate_ = false;
259 } 290 }
260 291
261 } // namespace net 292 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_stream.h ('k') | net/quic/quic_headers_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698