| 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 if (!in_flight_write_.buffer()) { | 1028 if (!in_flight_write_.buffer()) { |
| 1029 // Grab the next SpdyFrame to send. | 1029 // Grab the next SpdyFrame to send. |
| 1030 SpdyIOBuffer next_buffer = queue_.top(); | 1030 SpdyIOBuffer next_buffer = queue_.top(); |
| 1031 queue_.pop(); | 1031 queue_.pop(); |
| 1032 | 1032 |
| 1033 // We've deferred compression until just before we write it to the socket, | 1033 // We've deferred compression until just before we write it to the socket, |
| 1034 // which is now. At this time, we don't compress our data frames. | 1034 // which is now. At this time, we don't compress our data frames. |
| 1035 SpdyFrame uncompressed_frame(next_buffer.buffer()->data(), false); | 1035 SpdyFrame uncompressed_frame(next_buffer.buffer()->data(), false); |
| 1036 size_t size; | 1036 size_t size; |
| 1037 if (buffered_spdy_framer_->IsCompressible(uncompressed_frame)) { | 1037 if (buffered_spdy_framer_->IsCompressible(uncompressed_frame)) { |
| 1038 DCHECK(uncompressed_frame.is_control_frame()); |
| 1038 scoped_ptr<SpdyFrame> compressed_frame( | 1039 scoped_ptr<SpdyFrame> compressed_frame( |
| 1039 buffered_spdy_framer_->CompressFrame(uncompressed_frame)); | 1040 buffered_spdy_framer_->CompressControlFrame( |
| 1041 reinterpret_cast<const SpdyControlFrame&>(uncompressed_frame))); |
| 1040 if (!compressed_frame.get()) { | 1042 if (!compressed_frame.get()) { |
| 1041 CloseSessionOnError( | 1043 CloseSessionOnError( |
| 1042 net::ERR_SPDY_PROTOCOL_ERROR, true, "SPDY Compression failure."); | 1044 net::ERR_SPDY_PROTOCOL_ERROR, true, "SPDY Compression failure."); |
| 1043 return; | 1045 return; |
| 1044 } | 1046 } |
| 1045 | 1047 |
| 1046 size = compressed_frame->length() + SpdyFrame::kHeaderSize; | 1048 size = compressed_frame->length() + SpdyFrame::kHeaderSize; |
| 1047 | 1049 |
| 1048 DCHECK_GT(size, 0u); | 1050 DCHECK_GT(size, 0u); |
| 1049 | 1051 |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1964 SSLClientSocket* SpdySession::GetSSLClientSocket() const { | 1966 SSLClientSocket* SpdySession::GetSSLClientSocket() const { |
| 1965 if (!is_secure_) | 1967 if (!is_secure_) |
| 1966 return NULL; | 1968 return NULL; |
| 1967 SSLClientSocket* ssl_socket = | 1969 SSLClientSocket* ssl_socket = |
| 1968 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 1970 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
| 1969 DCHECK(ssl_socket); | 1971 DCHECK(ssl_socket); |
| 1970 return ssl_socket; | 1972 return ssl_socket; |
| 1971 } | 1973 } |
| 1972 | 1974 |
| 1973 } // namespace net | 1975 } // namespace net |
| OLD | NEW |