| 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 "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return ERR_UNEXPECTED; | 100 return ERR_UNEXPECTED; |
| 101 } | 101 } |
| 102 | 102 |
| 103 int SpdyWebSocketStream::OnResponseReceived( | 103 int SpdyWebSocketStream::OnResponseReceived( |
| 104 const SpdyHeaderBlock& response, | 104 const SpdyHeaderBlock& response, |
| 105 base::Time response_time, int status) { | 105 base::Time response_time, int status) { |
| 106 DCHECK(delegate_); | 106 DCHECK(delegate_); |
| 107 return delegate_->OnReceivedSpdyResponseHeader(response, status); | 107 return delegate_->OnReceivedSpdyResponseHeader(response, status); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void SpdyWebSocketStream::OnDataReceived(const char* data, int length) { | 110 int SpdyWebSocketStream::OnDataReceived(const char* data, int length) { |
| 111 DCHECK(delegate_); | 111 DCHECK(delegate_); |
| 112 delegate_->OnReceivedSpdyData(data, length); | 112 delegate_->OnReceivedSpdyData(data, length); |
| 113 return OK; |
| 113 } | 114 } |
| 114 | 115 |
| 115 void SpdyWebSocketStream::OnDataSent(int length) { | 116 void SpdyWebSocketStream::OnDataSent(int length) { |
| 116 DCHECK(delegate_); | 117 DCHECK(delegate_); |
| 117 delegate_->OnSentSpdyData(length); | 118 delegate_->OnSentSpdyData(length); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void SpdyWebSocketStream::OnClose(int status) { | 121 void SpdyWebSocketStream::OnClose(int status) { |
| 121 stream_ = NULL; | 122 stream_ = NULL; |
| 122 | 123 |
| 123 // Destruction without Close() call OnClose() with delegate_ being NULL. | 124 // Destruction without Close() call OnClose() with delegate_ being NULL. |
| 124 if (!delegate_) | 125 if (!delegate_) |
| 125 return; | 126 return; |
| 126 Delegate* delegate = delegate_; | 127 Delegate* delegate = delegate_; |
| 127 delegate_ = NULL; | 128 delegate_ = NULL; |
| 128 delegate->OnCloseSpdyStream(); | 129 delegate->OnCloseSpdyStream(); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void SpdyWebSocketStream::OnSpdyStreamCreated(int result) { | 132 void SpdyWebSocketStream::OnSpdyStreamCreated(int result) { |
| 132 DCHECK_NE(ERR_IO_PENDING, result); | 133 DCHECK_NE(ERR_IO_PENDING, result); |
| 133 if (result == OK) { | 134 if (result == OK) { |
| 134 DCHECK(stream_); | 135 DCHECK(stream_); |
| 135 stream_->SetDelegate(this); | 136 stream_->SetDelegate(this); |
| 136 } | 137 } |
| 137 DCHECK(delegate_); | 138 DCHECK(delegate_); |
| 138 delegate_->OnCreatedSpdyStream(result); | 139 delegate_->OnCreatedSpdyStream(result); |
| 139 } | 140 } |
| 140 | 141 |
| 141 } // namespace net | 142 } // namespace net |
| OLD | NEW |