| 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_websocket_stream.h" | 5 #include "net/spdy/spdy_websocket_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 12 #include "net/base/io_buffer.h" | |
| 13 #include "net/spdy/spdy_framer.h" | 13 #include "net/spdy/spdy_framer.h" |
| 14 #include "net/spdy/spdy_protocol.h" | 14 #include "net/spdy/spdy_protocol.h" |
| 15 #include "net/spdy/spdy_session.h" | 15 #include "net/spdy/spdy_session.h" |
| 16 #include "net/spdy/spdy_stream.h" | 16 #include "net/spdy/spdy_stream.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 SpdyWebSocketStream::SpdyWebSocketStream( | 20 SpdyWebSocketStream::SpdyWebSocketStream( |
| 21 SpdySession* spdy_session, Delegate* delegate) | 21 SpdySession* spdy_session, Delegate* delegate) |
| 22 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 22 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 base::Time response_time, int status) { | 109 base::Time response_time, int status) { |
| 110 DCHECK(delegate_); | 110 DCHECK(delegate_); |
| 111 return delegate_->OnReceivedSpdyResponseHeader(response, status); | 111 return delegate_->OnReceivedSpdyResponseHeader(response, status); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SpdyWebSocketStream::OnHeadersSent() { | 114 void SpdyWebSocketStream::OnHeadersSent() { |
| 115 // This will be called when WebSocket over SPDY supports new framing. | 115 // This will be called when WebSocket over SPDY supports new framing. |
| 116 NOTREACHED(); | 116 NOTREACHED(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 int SpdyWebSocketStream::OnDataReceived(const char* data, int length) { | 119 int SpdyWebSocketStream::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { |
| 120 DCHECK(delegate_); | 120 DCHECK(delegate_); |
| 121 delegate_->OnReceivedSpdyData(data, length); | 121 delegate_->OnReceivedSpdyData(buffer.Pass()); |
| 122 return OK; | 122 return OK; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SpdyWebSocketStream::OnDataSent(size_t bytes_sent) { | 125 void SpdyWebSocketStream::OnDataSent(size_t bytes_sent) { |
| 126 DCHECK(delegate_); | 126 DCHECK(delegate_); |
| 127 delegate_->OnSentSpdyData(bytes_sent); | 127 delegate_->OnSentSpdyData(bytes_sent); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void SpdyWebSocketStream::OnClose(int status) { | 130 void SpdyWebSocketStream::OnClose(int status) { |
| 131 stream_ = NULL; | 131 stream_ = NULL; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 143 if (result == OK) { | 143 if (result == OK) { |
| 144 stream_ = stream_request_.ReleaseStream(); | 144 stream_ = stream_request_.ReleaseStream(); |
| 145 DCHECK(stream_); | 145 DCHECK(stream_); |
| 146 stream_->SetDelegate(this); | 146 stream_->SetDelegate(this); |
| 147 } | 147 } |
| 148 DCHECK(delegate_); | 148 DCHECK(delegate_); |
| 149 delegate_->OnCreatedSpdyStream(result); | 149 delegate_->OnCreatedSpdyStream(result); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace net | 152 } // namespace net |
| OLD | NEW |