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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 SpdyStreamId promised_stream_id, | 264 SpdyStreamId promised_stream_id, |
265 NetLog::LogLevel log_level) { | 265 NetLog::LogLevel log_level) { |
266 base::DictionaryValue* dict = new base::DictionaryValue(); | 266 base::DictionaryValue* dict = new base::DictionaryValue(); |
267 dict->Set("headers", | 267 dict->Set("headers", |
268 SpdyHeaderBlockToListValue(*headers, log_level).release()); | 268 SpdyHeaderBlockToListValue(*headers, log_level).release()); |
269 dict->SetInteger("id", stream_id); | 269 dict->SetInteger("id", stream_id); |
270 dict->SetInteger("promised_stream_id", promised_stream_id); | 270 dict->SetInteger("promised_stream_id", promised_stream_id); |
271 return dict; | 271 return dict; |
272 } | 272 } |
273 | 273 |
| 274 base::Value* NetLogSpdyAdoptedPushStreamCallback( |
| 275 SpdyStreamId stream_id, const GURL* url, NetLog::LogLevel log_level) { |
| 276 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 277 dict->SetInteger("stream_id", stream_id); |
| 278 dict->SetString("url", url->spec()); |
| 279 return dict; |
| 280 } |
| 281 |
274 // Helper function to return the total size of an array of objects | 282 // Helper function to return the total size of an array of objects |
275 // with .size() member functions. | 283 // with .size() member functions. |
276 template <typename T, size_t N> size_t GetTotalSize(const T (&arr)[N]) { | 284 template <typename T, size_t N> size_t GetTotalSize(const T (&arr)[N]) { |
277 size_t total_size = 0; | 285 size_t total_size = 0; |
278 for (size_t i = 0; i < N; ++i) { | 286 for (size_t i = 0; i < N; ++i) { |
279 total_size += arr[i].size(); | 287 total_size += arr[i].size(); |
280 } | 288 } |
281 return total_size; | 289 return total_size; |
282 } | 290 } |
283 | 291 |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 | 1964 |
1957 SpdyStreamId stream_id = unclaimed_it->second.stream_id; | 1965 SpdyStreamId stream_id = unclaimed_it->second.stream_id; |
1958 unclaimed_pushed_streams_.erase(unclaimed_it); | 1966 unclaimed_pushed_streams_.erase(unclaimed_it); |
1959 | 1967 |
1960 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); | 1968 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); |
1961 if (active_it == active_streams_.end()) { | 1969 if (active_it == active_streams_.end()) { |
1962 NOTREACHED(); | 1970 NOTREACHED(); |
1963 return base::WeakPtr<SpdyStream>(); | 1971 return base::WeakPtr<SpdyStream>(); |
1964 } | 1972 } |
1965 | 1973 |
1966 net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM); | 1974 net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM, |
| 1975 base::Bind(&NetLogSpdyAdoptedPushStreamCallback, |
| 1976 active_it->second.stream->stream_id(), &url)); |
1967 used_push_streams.Increment(); | 1977 used_push_streams.Increment(); |
1968 return active_it->second.stream->GetWeakPtr(); | 1978 return active_it->second.stream->GetWeakPtr(); |
1969 } | 1979 } |
1970 | 1980 |
1971 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, | 1981 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, |
1972 bool* was_npn_negotiated, | 1982 bool* was_npn_negotiated, |
1973 NextProto* protocol_negotiated) { | 1983 NextProto* protocol_negotiated) { |
1974 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); | 1984 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); |
1975 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); | 1985 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); |
1976 return connection_->socket()->GetSSLInfo(ssl_info); | 1986 return connection_->socket()->GetSSLInfo(ssl_info); |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3262 if (!queue->empty()) { | 3272 if (!queue->empty()) { |
3263 SpdyStreamId stream_id = queue->front(); | 3273 SpdyStreamId stream_id = queue->front(); |
3264 queue->pop_front(); | 3274 queue->pop_front(); |
3265 return stream_id; | 3275 return stream_id; |
3266 } | 3276 } |
3267 } | 3277 } |
3268 return 0; | 3278 return 0; |
3269 } | 3279 } |
3270 | 3280 |
3271 } // namespace net | 3281 } // namespace net |
OLD | NEW |