| 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   854   DCHECK(frame_type == HEADERS || |   854   DCHECK(frame_type == HEADERS || | 
|   855          frame_type == DATA || |   855          frame_type == DATA || | 
|   856          frame_type == CREDENTIAL || |   856          frame_type == CREDENTIAL || | 
|   857          frame_type == SYN_STREAM); |   857          frame_type == SYN_STREAM); | 
|   858   EnqueueWrite(stream->priority(), frame_type, producer.Pass(), stream); |   858   EnqueueWrite(stream->priority(), frame_type, producer.Pass(), stream); | 
|   859 } |   859 } | 
|   860  |   860  | 
|   861 scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( |   861 scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( | 
|   862     SpdyStreamId stream_id, |   862     SpdyStreamId stream_id, | 
|   863     RequestPriority priority, |   863     RequestPriority priority, | 
|   864     uint8 credential_slot, |  | 
|   865     SpdyControlFlags flags, |   864     SpdyControlFlags flags, | 
|   866     const SpdyHeaderBlock& headers) { |   865     const SpdyHeaderBlock& headers) { | 
|   867   ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); |   866   ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); | 
|   868   CHECK(it != active_streams_.end()); |   867   CHECK(it != active_streams_.end()); | 
|   869   CHECK_EQ(it->second.stream->stream_id(), stream_id); |   868   CHECK_EQ(it->second.stream->stream_id(), stream_id); | 
|   870  |   869  | 
|   871   SendPrefacePingIfNoneInFlight(); |   870   SendPrefacePingIfNoneInFlight(); | 
|   872  |   871  | 
|   873   DCHECK(buffered_spdy_framer_.get()); |   872   DCHECK(buffered_spdy_framer_.get()); | 
|   874   SpdyPriority spdy_priority = |   873   SpdyPriority spdy_priority = | 
|   875       ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion()); |   874       ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion()); | 
|   876   scoped_ptr<SpdyFrame> syn_frame( |   875   scoped_ptr<SpdyFrame> syn_frame( | 
|   877       buffered_spdy_framer_->CreateSynStream( |   876       buffered_spdy_framer_->CreateSynStream(stream_id, 0, spdy_priority, flags, | 
|   878           stream_id, 0, spdy_priority, |   877                                              &headers)); | 
|   879           credential_slot, flags, &headers)); |  | 
|   880  |   878  | 
|   881   base::StatsCounter spdy_requests("spdy.requests"); |   879   base::StatsCounter spdy_requests("spdy.requests"); | 
|   882   spdy_requests.Increment(); |   880   spdy_requests.Increment(); | 
|   883   streams_initiated_count_++; |   881   streams_initiated_count_++; | 
|   884  |   882  | 
|   885   if (net_log().IsLoggingAllEvents()) { |   883   if (net_log().IsLoggingAllEvents()) { | 
|   886     net_log().AddEvent( |   884     net_log().AddEvent( | 
|   887         NetLog::TYPE_SPDY_SESSION_SYN_STREAM, |   885         NetLog::TYPE_SPDY_SESSION_SYN_STREAM, | 
|   888         base::Bind(&NetLogSpdySynStreamSentCallback, &headers, |   886         base::Bind(&NetLogSpdySynStreamSentCallback, &headers, | 
|   889                    (flags & CONTROL_FLAG_FIN) != 0, |   887                    (flags & CONTROL_FLAG_FIN) != 0, | 
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2026   if (rv < 0) { |  2024   if (rv < 0) { | 
|  2027     DCHECK_NE(rv, ERR_IO_PENDING); |  2025     DCHECK_NE(rv, ERR_IO_PENDING); | 
|  2028     DCHECK(active_streams_.find(stream_id) == active_streams_.end()); |  2026     DCHECK(active_streams_.find(stream_id) == active_streams_.end()); | 
|  2029   } |  2027   } | 
|  2030   return rv; |  2028   return rv; | 
|  2031 } |  2029 } | 
|  2032  |  2030  | 
|  2033 void SpdySession::OnSynStream(SpdyStreamId stream_id, |  2031 void SpdySession::OnSynStream(SpdyStreamId stream_id, | 
|  2034                               SpdyStreamId associated_stream_id, |  2032                               SpdyStreamId associated_stream_id, | 
|  2035                               SpdyPriority priority, |  2033                               SpdyPriority priority, | 
|  2036                               uint8 credential_slot, |  | 
|  2037                               bool fin, |  2034                               bool fin, | 
|  2038                               bool unidirectional, |  2035                               bool unidirectional, | 
|  2039                               const SpdyHeaderBlock& headers) { |  2036                               const SpdyHeaderBlock& headers) { | 
|  2040   CHECK(in_io_loop_); |  2037   CHECK(in_io_loop_); | 
|  2041  |  2038  | 
|  2042   if (availability_state_ == STATE_CLOSED) |  2039   if (availability_state_ == STATE_CLOSED) | 
|  2043     return; |  2040     return; | 
|  2044  |  2041  | 
|  2045   base::Time response_time = base::Time::Now(); |  2042   base::Time response_time = base::Time::Now(); | 
|  2046   base::TimeTicks recv_first_byte_time = time_func_(); |  2043   base::TimeTicks recv_first_byte_time = time_func_(); | 
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3034     if (!queue->empty()) { |  3031     if (!queue->empty()) { | 
|  3035       SpdyStreamId stream_id = queue->front(); |  3032       SpdyStreamId stream_id = queue->front(); | 
|  3036       queue->pop_front(); |  3033       queue->pop_front(); | 
|  3037       return stream_id; |  3034       return stream_id; | 
|  3038     } |  3035     } | 
|  3039   } |  3036   } | 
|  3040   return 0; |  3037   return 0; | 
|  3041 } |  3038 } | 
|  3042  |  3039  | 
|  3043 }  // namespace net |  3040 }  // namespace net | 
| OLD | NEW |