OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/websockets/websocket_channel.h" | 5 #include "net/websockets/websocket_channel.h" |
6 | 6 |
7 #include <limits.h> // for INT_MAX | 7 #include <limits.h> // for INT_MAX |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 ScopedVector<WebSocketFrame> frames_; | 143 ScopedVector<WebSocketFrame> frames_; |
144 | 144 |
145 // The total size of the payload data in |frames_|. This will be used to | 145 // The total size of the payload data in |frames_|. This will be used to |
146 // measure the throughput of the link. | 146 // measure the throughput of the link. |
147 // TODO(ricea): Measure the throughput of the link. | 147 // TODO(ricea): Measure the throughput of the link. |
148 uint64 total_bytes_; | 148 uint64 total_bytes_; |
149 }; | 149 }; |
150 | 150 |
151 void WebSocketChannel::SendBuffer::AddFrame(scoped_ptr<WebSocketFrame> frame) { | 151 void WebSocketChannel::SendBuffer::AddFrame(scoped_ptr<WebSocketFrame> frame) { |
152 total_bytes_ += frame->header.payload_length; | 152 total_bytes_ += frame->header.payload_length; |
153 frames_.push_back(frame.release()); | 153 frames_.push_back(frame.Pass()); |
154 } | 154 } |
155 | 155 |
156 // Implementation of WebSocketStream::ConnectDelegate that simply forwards the | 156 // Implementation of WebSocketStream::ConnectDelegate that simply forwards the |
157 // calls on to the WebSocketChannel that created it. | 157 // calls on to the WebSocketChannel that created it. |
158 class WebSocketChannel::ConnectDelegate | 158 class WebSocketChannel::ConnectDelegate |
159 : public WebSocketStream::ConnectDelegate { | 159 : public WebSocketStream::ConnectDelegate { |
160 public: | 160 public: |
161 explicit ConnectDelegate(WebSocketChannel* creator) : creator_(creator) {} | 161 explicit ConnectDelegate(WebSocketChannel* creator) : creator_(creator) {} |
162 | 162 |
163 void OnSuccess(scoped_ptr<WebSocketStream> stream) override { | 163 void OnSuccess(scoped_ptr<WebSocketStream> stream) override { |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 } | 1144 } |
1145 | 1145 |
1146 void WebSocketChannel::CloseTimeout() { | 1146 void WebSocketChannel::CloseTimeout() { |
1147 stream_->Close(); | 1147 stream_->Close(); |
1148 SetState(CLOSED); | 1148 SetState(CLOSED); |
1149 DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); | 1149 DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); |
1150 // |this| has been deleted. | 1150 // |this| has been deleted. |
1151 } | 1151 } |
1152 | 1152 |
1153 } // namespace net | 1153 } // namespace net |
OLD | NEW |