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

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

Issue 1824403002: Add logging for headers sent and received in BidirectionalStreamQuicImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/quic/quic_chromium_client_session.h" 12 #include "net/quic/quic_chromium_client_session.h"
13 #include "net/quic/quic_http_utils.h"
13 #include "net/quic/quic_spdy_session.h" 14 #include "net/quic/quic_spdy_session.h"
14 #include "net/quic/quic_write_blocked_list.h" 15 #include "net/quic/quic_write_blocked_list.h"
15 #include "net/quic/spdy_utils.h" 16 #include "net/quic/spdy_utils.h"
16 17
17 namespace net { 18 namespace net {
18 19
19 QuicChromiumClientStream::QuicChromiumClientStream( 20 QuicChromiumClientStream::QuicChromiumClientStream(
20 QuicStreamId id, 21 QuicStreamId id,
21 QuicClientSessionBase* session, 22 QuicClientSessionBase* session,
22 const BoundNetLog& net_log) 23 const BoundNetLog& net_log)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 98 }
98 99
99 void QuicChromiumClientStream::OnCanWrite() { 100 void QuicChromiumClientStream::OnCanWrite() {
100 ReliableQuicStream::OnCanWrite(); 101 ReliableQuicStream::OnCanWrite();
101 102
102 if (!HasBufferedData() && !callback_.is_null()) { 103 if (!HasBufferedData() && !callback_.is_null()) {
103 base::ResetAndReturn(&callback_).Run(OK); 104 base::ResetAndReturn(&callback_).Run(OK);
104 } 105 }
105 } 106 }
106 107
108 size_t QuicChromiumClientStream::WriteHeaders(
109 const SpdyHeaderBlock& header_block,
110 bool fin,
111 QuicAckListenerInterface* ack_notifier_delegate) {
112 // Log request headers to the QuicSession's net log.
mmenke 2016/03/23 20:32:21 Think these comments are confusing - we're logging
xunjieli 2016/03/23 22:19:23 Done.
113 net_log_.AddEvent(
114 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
115 base::Bind(&QuicRequestNetLogCallback, id(), &header_block,
116 QuicSpdyStream::priority()));
117 return QuicSpdyStream::WriteHeaders(header_block, fin, ack_notifier_delegate);
118 }
119
107 SpdyPriority QuicChromiumClientStream::priority() const { 120 SpdyPriority QuicChromiumClientStream::priority() const {
108 if (delegate_ && delegate_->HasSendHeadersComplete()) { 121 if (delegate_ && delegate_->HasSendHeadersComplete()) {
109 return QuicSpdyStream::priority(); 122 return QuicSpdyStream::priority();
110 } 123 }
111 return net::kV3HighestPriority; 124 return net::kV3HighestPriority;
112 } 125 }
113 126
114 int QuicChromiumClientStream::WriteStreamData( 127 int QuicChromiumClientStream::WriteStreamData(
115 base::StringPiece data, 128 base::StringPiece data,
116 bool fin, 129 bool fin,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 base::Bind(&QuicChromiumClientStream::NotifyDelegateOfHeadersComplete, 193 base::Bind(&QuicChromiumClientStream::NotifyDelegateOfHeadersComplete,
181 weak_factory_.GetWeakPtr(), headers, frame_len)); 194 weak_factory_.GetWeakPtr(), headers, frame_len));
182 } 195 }
183 196
184 void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete( 197 void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete(
185 SpdyHeaderBlock headers, 198 SpdyHeaderBlock headers,
186 size_t frame_len) { 199 size_t frame_len) {
187 if (!delegate_) 200 if (!delegate_)
188 return; 201 return;
189 // Only mark trailers consumed when we are about to notify delegate. 202 // Only mark trailers consumed when we are about to notify delegate.
190 if (headers_delivered_) 203 if (headers_delivered_) {
191 MarkTrailersConsumed(decompressed_trailers().length()); 204 MarkTrailersConsumed(decompressed_trailers().length());
205 // Log response trailers to the QuicSession's net log.
206 net_log_.AddEvent(
207 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
208 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
209 } else {
210 headers_delivered_ = true;
211 // Log response headers to the QuicSession's net log.
212 net_log_.AddEvent(
213 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
214 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
215 }
192 216
193 headers_delivered_ = true;
194 delegate_->OnHeadersAvailable(headers, frame_len); 217 delegate_->OnHeadersAvailable(headers, frame_len);
195 } 218 }
196 219
197 void QuicChromiumClientStream::NotifyDelegateOfDataAvailableLater() { 220 void QuicChromiumClientStream::NotifyDelegateOfDataAvailableLater() {
198 RunOrBuffer( 221 RunOrBuffer(
199 base::Bind(&QuicChromiumClientStream::NotifyDelegateOfDataAvailable, 222 base::Bind(&QuicChromiumClientStream::NotifyDelegateOfDataAvailable,
200 weak_factory_.GetWeakPtr())); 223 weak_factory_.GetWeakPtr()));
201 } 224 }
202 225
203 void QuicChromiumClientStream::NotifyDelegateOfDataAvailable() { 226 void QuicChromiumClientStream::NotifyDelegateOfDataAvailable() {
204 if (delegate_) 227 if (delegate_)
205 delegate_->OnDataAvailable(); 228 delegate_->OnDataAvailable();
206 } 229 }
207 230
208 void QuicChromiumClientStream::RunOrBuffer(base::Closure closure) { 231 void QuicChromiumClientStream::RunOrBuffer(base::Closure closure) {
209 if (delegate_) { 232 if (delegate_) {
210 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure); 233 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure);
211 } else { 234 } else {
212 delegate_tasks_.push_back(closure); 235 delegate_tasks_.push_back(closure);
213 } 236 }
214 } 237 }
215 238
216 void QuicChromiumClientStream::DisableConnectionMigration() { 239 void QuicChromiumClientStream::DisableConnectionMigration() {
217 can_migrate_ = false; 240 can_migrate_ = false;
218 } 241 }
219 242
220 } // namespace net 243 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698