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_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 23 matching lines...) Loading... |
34 #include "net/cert/asn1_util.h" | 34 #include "net/cert/asn1_util.h" |
35 #include "net/cert/cert_verify_result.h" | 35 #include "net/cert/cert_verify_result.h" |
36 #include "net/cert/ct_policy_status.h" | 36 #include "net/cert/ct_policy_status.h" |
37 #include "net/http/http_network_session.h" | 37 #include "net/http/http_network_session.h" |
38 #include "net/http/http_server_properties.h" | 38 #include "net/http/http_server_properties.h" |
39 #include "net/http/http_util.h" | 39 #include "net/http/http_util.h" |
40 #include "net/http/transport_security_state.h" | 40 #include "net/http/transport_security_state.h" |
41 #include "net/log/net_log.h" | 41 #include "net/log/net_log.h" |
42 #include "net/log/net_log_capture_mode.h" | 42 #include "net/log/net_log_capture_mode.h" |
43 #include "net/log/net_log_event_type.h" | 43 #include "net/log/net_log_event_type.h" |
44 #include "net/log/net_log_source.h" | |
45 #include "net/log/net_log_source_type.h" | 44 #include "net/log/net_log_source_type.h" |
46 #include "net/log/net_log_with_source.h" | 45 #include "net/log/net_log_with_source.h" |
47 #include "net/proxy/proxy_server.h" | 46 #include "net/proxy/proxy_server.h" |
48 #include "net/socket/socket.h" | 47 #include "net/socket/socket.h" |
49 #include "net/socket/ssl_client_socket.h" | 48 #include "net/socket/ssl_client_socket.h" |
50 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" | 49 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" |
51 #include "net/spdy/spdy_buffer_producer.h" | 50 #include "net/spdy/spdy_buffer_producer.h" |
52 #include "net/spdy/spdy_frame_builder.h" | 51 #include "net/spdy/spdy_frame_builder.h" |
53 #include "net/spdy/spdy_http_utils.h" | 52 #include "net/spdy/spdy_http_utils.h" |
54 #include "net/spdy/spdy_log_util.h" | 53 #include "net/spdy/spdy_log_util.h" |
(...skipping 49 matching lines...) Loading... |
104 } | 103 } |
105 | 104 |
106 std::unique_ptr<base::Value> NetLogSpdyHeadersSentCallback( | 105 std::unique_ptr<base::Value> NetLogSpdyHeadersSentCallback( |
107 const SpdyHeaderBlock* headers, | 106 const SpdyHeaderBlock* headers, |
108 bool fin, | 107 bool fin, |
109 SpdyStreamId stream_id, | 108 SpdyStreamId stream_id, |
110 bool has_priority, | 109 bool has_priority, |
111 int weight, | 110 int weight, |
112 SpdyStreamId parent_stream_id, | 111 SpdyStreamId parent_stream_id, |
113 bool exclusive, | 112 bool exclusive, |
| 113 NetLogSource source_dependency, |
114 NetLogCaptureMode capture_mode) { | 114 NetLogCaptureMode capture_mode) { |
115 auto dict = base::MakeUnique<base::DictionaryValue>(); | 115 auto dict = base::MakeUnique<base::DictionaryValue>(); |
116 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode)); | 116 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode)); |
117 dict->SetBoolean("fin", fin); | 117 dict->SetBoolean("fin", fin); |
118 dict->SetInteger("stream_id", stream_id); | 118 dict->SetInteger("stream_id", stream_id); |
119 dict->SetBoolean("has_priority", has_priority); | 119 dict->SetBoolean("has_priority", has_priority); |
120 if (has_priority) { | 120 if (has_priority) { |
121 dict->SetInteger("parent_stream_id", parent_stream_id); | 121 dict->SetInteger("parent_stream_id", parent_stream_id); |
122 dict->SetInteger("weight", weight); | 122 dict->SetInteger("weight", weight); |
123 dict->SetBoolean("exclusive", exclusive); | 123 dict->SetBoolean("exclusive", exclusive); |
124 } | 124 } |
| 125 if (source_dependency.IsValid()) { |
| 126 source_dependency.AddToEventParameters(dict.get()); |
| 127 } |
125 return std::move(dict); | 128 return std::move(dict); |
126 } | 129 } |
127 | 130 |
128 std::unique_ptr<base::Value> NetLogSpdyHeadersReceivedCallback( | 131 std::unique_ptr<base::Value> NetLogSpdyHeadersReceivedCallback( |
129 const SpdyHeaderBlock* headers, | 132 const SpdyHeaderBlock* headers, |
130 bool fin, | 133 bool fin, |
131 SpdyStreamId stream_id, | 134 SpdyStreamId stream_id, |
132 NetLogCaptureMode capture_mode) { | 135 NetLogCaptureMode capture_mode) { |
133 auto dict = base::MakeUnique<base::DictionaryValue>(); | 136 auto dict = base::MakeUnique<base::DictionaryValue>(); |
134 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode)); | 137 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode)); |
(...skipping 799 matching lines...) Loading... |
934 SpdyFrameType frame_type, | 937 SpdyFrameType frame_type, |
935 std::unique_ptr<SpdyBufferProducer> producer) { | 938 std::unique_ptr<SpdyBufferProducer> producer) { |
936 DCHECK(frame_type == HEADERS || frame_type == DATA); | 939 DCHECK(frame_type == HEADERS || frame_type == DATA); |
937 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); | 940 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); |
938 } | 941 } |
939 | 942 |
940 std::unique_ptr<SpdySerializedFrame> SpdySession::CreateHeaders( | 943 std::unique_ptr<SpdySerializedFrame> SpdySession::CreateHeaders( |
941 SpdyStreamId stream_id, | 944 SpdyStreamId stream_id, |
942 RequestPriority priority, | 945 RequestPriority priority, |
943 SpdyControlFlags flags, | 946 SpdyControlFlags flags, |
944 SpdyHeaderBlock block) { | 947 SpdyHeaderBlock block, |
| 948 NetLogSource source_dependency) { |
945 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); | 949 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); |
946 CHECK(it != active_streams_.end()); | 950 CHECK(it != active_streams_.end()); |
947 CHECK_EQ(it->second->stream_id(), stream_id); | 951 CHECK_EQ(it->second->stream_id(), stream_id); |
948 | 952 |
949 SendPrefacePingIfNoneInFlight(); | 953 SendPrefacePingIfNoneInFlight(); |
950 | 954 |
951 DCHECK(buffered_spdy_framer_.get()); | 955 DCHECK(buffered_spdy_framer_.get()); |
952 SpdyPriority spdy_priority = ConvertRequestPriorityToSpdyPriority(priority); | 956 SpdyPriority spdy_priority = ConvertRequestPriorityToSpdyPriority(priority); |
953 | 957 |
954 std::unique_ptr<SpdySerializedFrame> syn_frame; | 958 std::unique_ptr<SpdySerializedFrame> syn_frame; |
955 bool has_priority = true; | 959 bool has_priority = true; |
956 int weight = Spdy3PriorityToHttp2Weight(spdy_priority); | 960 int weight = Spdy3PriorityToHttp2Weight(spdy_priority); |
957 SpdyStreamId dependent_stream_id = 0; | 961 SpdyStreamId dependent_stream_id = 0; |
958 bool exclusive = false; | 962 bool exclusive = false; |
959 | 963 |
960 priority_dependency_state_.OnStreamCreation(stream_id, spdy_priority, | 964 priority_dependency_state_.OnStreamCreation(stream_id, spdy_priority, |
961 &dependent_stream_id, &exclusive); | 965 &dependent_stream_id, &exclusive); |
962 | 966 |
963 if (net_log().IsCapturing()) { | 967 if (net_log().IsCapturing()) { |
964 net_log().AddEvent( | 968 net_log().AddEvent( |
965 NetLogEventType::HTTP2_SESSION_SEND_HEADERS, | 969 NetLogEventType::HTTP2_SESSION_SEND_HEADERS, |
966 base::Bind(&NetLogSpdyHeadersSentCallback, &block, | 970 base::Bind(&NetLogSpdyHeadersSentCallback, &block, |
967 (flags & CONTROL_FLAG_FIN) != 0, stream_id, has_priority, | 971 (flags & CONTROL_FLAG_FIN) != 0, stream_id, has_priority, |
968 weight, dependent_stream_id, exclusive)); | 972 weight, dependent_stream_id, exclusive, source_dependency)); |
969 } | 973 } |
970 | 974 |
971 SpdyHeadersIR headers(stream_id, std::move(block)); | 975 SpdyHeadersIR headers(stream_id, std::move(block)); |
972 headers.set_has_priority(has_priority); | 976 headers.set_has_priority(has_priority); |
973 headers.set_weight(weight); | 977 headers.set_weight(weight); |
974 headers.set_parent_stream_id(dependent_stream_id); | 978 headers.set_parent_stream_id(dependent_stream_id); |
975 headers.set_exclusive(exclusive); | 979 headers.set_exclusive(exclusive); |
976 headers.set_fin((flags & CONTROL_FLAG_FIN) != 0); | 980 headers.set_fin((flags & CONTROL_FLAG_FIN) != 0); |
977 syn_frame.reset( | 981 syn_frame.reset( |
978 new SpdySerializedFrame(buffered_spdy_framer_->SerializeFrame(headers))); | 982 new SpdySerializedFrame(buffered_spdy_framer_->SerializeFrame(headers))); |
(...skipping 2214 matching lines...) Loading... |
3193 if (!queue->empty()) { | 3197 if (!queue->empty()) { |
3194 SpdyStreamId stream_id = queue->front(); | 3198 SpdyStreamId stream_id = queue->front(); |
3195 queue->pop_front(); | 3199 queue->pop_front(); |
3196 return stream_id; | 3200 return stream_id; |
3197 } | 3201 } |
3198 } | 3202 } |
3199 return 0; | 3203 return 0; |
3200 } | 3204 } |
3201 | 3205 |
3202 } // namespace net | 3206 } // namespace net |
OLD | NEW |