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

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

Issue 1932853002: Log urls and headers in BIDIRECTIONAL_STREAM events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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_session.cc ('k') | no next file » | 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_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 namespace { 55 namespace {
56 56
57 const int kReadBufferSize = 8 * 1024; 57 const int kReadBufferSize = 8 * 1024;
58 const int kDefaultConnectionAtRiskOfLossSeconds = 10; 58 const int kDefaultConnectionAtRiskOfLossSeconds = 10;
59 const int kHungIntervalSeconds = 10; 59 const int kHungIntervalSeconds = 10;
60 60
61 // Minimum seconds that unclaimed pushed streams will be kept in memory. 61 // Minimum seconds that unclaimed pushed streams will be kept in memory.
62 const int kMinPushedStreamLifetimeSeconds = 300; 62 const int kMinPushedStreamLifetimeSeconds = 300;
63 63
64 std::unique_ptr<base::ListValue> SpdyHeaderBlockToListValue(
65 const SpdyHeaderBlock& headers,
66 NetLogCaptureMode capture_mode) {
67 std::unique_ptr<base::ListValue> headers_list(new base::ListValue());
68 for (SpdyHeaderBlock::const_iterator it = headers.begin();
69 it != headers.end(); ++it) {
70 headers_list->AppendString(
71 it->first.as_string() + ": " +
72 ElideHeaderValueForNetLog(capture_mode, it->first.as_string(),
73 it->second.as_string()));
74 }
75 return headers_list;
76 }
77
78 std::unique_ptr<base::Value> NetLogSpdySynStreamSentCallback( 64 std::unique_ptr<base::Value> NetLogSpdySynStreamSentCallback(
79 const SpdyHeaderBlock* headers, 65 const SpdyHeaderBlock* headers,
80 bool fin, 66 bool fin,
81 bool unidirectional, 67 bool unidirectional,
82 SpdyPriority spdy_priority, 68 SpdyPriority spdy_priority,
83 SpdyStreamId stream_id, 69 SpdyStreamId stream_id,
84 NetLogCaptureMode capture_mode) { 70 NetLogCaptureMode capture_mode) {
85 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 71 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
86 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); 72 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode));
87 dict->SetBoolean("fin", fin); 73 dict->SetBoolean("fin", fin);
88 dict->SetBoolean("unidirectional", unidirectional); 74 dict->SetBoolean("unidirectional", unidirectional);
89 dict->SetInteger("priority", static_cast<int>(spdy_priority)); 75 dict->SetInteger("priority", static_cast<int>(spdy_priority));
90 dict->SetInteger("stream_id", stream_id); 76 dict->SetInteger("stream_id", stream_id);
91 return std::move(dict); 77 return std::move(dict);
92 } 78 }
93 79
94 std::unique_ptr<base::Value> NetLogSpdyHeadersSentCallback( 80 std::unique_ptr<base::Value> NetLogSpdyHeadersSentCallback(
95 const SpdyHeaderBlock* headers, 81 const SpdyHeaderBlock* headers,
96 bool fin, 82 bool fin,
97 SpdyStreamId stream_id, 83 SpdyStreamId stream_id,
98 bool has_priority, 84 bool has_priority,
99 uint32_t priority, 85 uint32_t priority,
100 SpdyStreamId parent_stream_id, 86 SpdyStreamId parent_stream_id,
101 bool exclusive, 87 bool exclusive,
102 NetLogCaptureMode capture_mode) { 88 NetLogCaptureMode capture_mode) {
103 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 89 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
104 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); 90 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode));
105 dict->SetBoolean("fin", fin); 91 dict->SetBoolean("fin", fin);
106 dict->SetInteger("stream_id", stream_id); 92 dict->SetInteger("stream_id", stream_id);
107 dict->SetBoolean("has_priority", has_priority); 93 dict->SetBoolean("has_priority", has_priority);
108 if (has_priority) { 94 if (has_priority) {
109 dict->SetInteger("parent_stream_id", parent_stream_id); 95 dict->SetInteger("parent_stream_id", parent_stream_id);
110 dict->SetInteger("priority", static_cast<int>(priority)); 96 dict->SetInteger("priority", static_cast<int>(priority));
111 dict->SetBoolean("exclusive", exclusive); 97 dict->SetBoolean("exclusive", exclusive);
112 } 98 }
113 return std::move(dict); 99 return std::move(dict);
114 } 100 }
115 101
116 std::unique_ptr<base::Value> NetLogSpdySynStreamReceivedCallback( 102 std::unique_ptr<base::Value> NetLogSpdySynStreamReceivedCallback(
117 const SpdyHeaderBlock* headers, 103 const SpdyHeaderBlock* headers,
118 bool fin, 104 bool fin,
119 bool unidirectional, 105 bool unidirectional,
120 SpdyPriority spdy_priority, 106 SpdyPriority spdy_priority,
121 SpdyStreamId stream_id, 107 SpdyStreamId stream_id,
122 SpdyStreamId associated_stream, 108 SpdyStreamId associated_stream,
123 NetLogCaptureMode capture_mode) { 109 NetLogCaptureMode capture_mode) {
124 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 110 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
125 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); 111 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode));
126 dict->SetBoolean("fin", fin); 112 dict->SetBoolean("fin", fin);
127 dict->SetBoolean("unidirectional", unidirectional); 113 dict->SetBoolean("unidirectional", unidirectional);
128 dict->SetInteger("priority", static_cast<int>(spdy_priority)); 114 dict->SetInteger("priority", static_cast<int>(spdy_priority));
129 dict->SetInteger("stream_id", stream_id); 115 dict->SetInteger("stream_id", stream_id);
130 dict->SetInteger("associated_stream", associated_stream); 116 dict->SetInteger("associated_stream", associated_stream);
131 return std::move(dict); 117 return std::move(dict);
132 } 118 }
133 119
134 std::unique_ptr<base::Value> NetLogSpdySynReplyOrHeadersReceivedCallback( 120 std::unique_ptr<base::Value> NetLogSpdySynReplyOrHeadersReceivedCallback(
135 const SpdyHeaderBlock* headers, 121 const SpdyHeaderBlock* headers,
136 bool fin, 122 bool fin,
137 SpdyStreamId stream_id, 123 SpdyStreamId stream_id,
138 NetLogCaptureMode capture_mode) { 124 NetLogCaptureMode capture_mode) {
139 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 125 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
140 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); 126 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode));
141 dict->SetBoolean("fin", fin); 127 dict->SetBoolean("fin", fin);
142 dict->SetInteger("stream_id", stream_id); 128 dict->SetInteger("stream_id", stream_id);
143 return std::move(dict); 129 return std::move(dict);
144 } 130 }
145 131
146 std::unique_ptr<base::Value> NetLogSpdySessionCloseCallback( 132 std::unique_ptr<base::Value> NetLogSpdySessionCloseCallback(
147 int net_error, 133 int net_error,
148 const std::string* description, 134 const std::string* description,
149 NetLogCaptureMode /* capture_mode */) { 135 NetLogCaptureMode /* capture_mode */) {
150 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 136 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 ElideGoAwayDebugDataForNetLog(capture_mode, debug_data)); 279 ElideGoAwayDebugDataForNetLog(capture_mode, debug_data));
294 return std::move(dict); 280 return std::move(dict);
295 } 281 }
296 282
297 std::unique_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback( 283 std::unique_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback(
298 const SpdyHeaderBlock* headers, 284 const SpdyHeaderBlock* headers,
299 SpdyStreamId stream_id, 285 SpdyStreamId stream_id,
300 SpdyStreamId promised_stream_id, 286 SpdyStreamId promised_stream_id,
301 NetLogCaptureMode capture_mode) { 287 NetLogCaptureMode capture_mode) {
302 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 288 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
303 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); 289 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode));
304 dict->SetInteger("id", stream_id); 290 dict->SetInteger("id", stream_id);
305 dict->SetInteger("promised_stream_id", promised_stream_id); 291 dict->SetInteger("promised_stream_id", promised_stream_id);
306 return std::move(dict); 292 return std::move(dict);
307 } 293 }
308 294
309 std::unique_ptr<base::Value> NetLogSpdyAdoptedPushStreamCallback( 295 std::unique_ptr<base::Value> NetLogSpdyAdoptedPushStreamCallback(
310 SpdyStreamId stream_id, 296 SpdyStreamId stream_id,
311 const GURL* url, 297 const GURL* url,
312 NetLogCaptureMode capture_mode) { 298 NetLogCaptureMode capture_mode) {
313 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 299 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
(...skipping 3015 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 if (!queue->empty()) { 3315 if (!queue->empty()) {
3330 SpdyStreamId stream_id = queue->front(); 3316 SpdyStreamId stream_id = queue->front();
3331 queue->pop_front(); 3317 queue->pop_front();
3332 return stream_id; 3318 return stream_id;
3333 } 3319 }
3334 } 3320 }
3335 return 0; 3321 return 0;
3336 } 3322 }
3337 3323
3338 } // namespace net 3324 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698