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 #ifndef NET_WEBSOCKETS_WEBSOCKET_BASIC_STREAM_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_BASIC_STREAM_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_BASIC_STREAM_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_BASIC_STREAM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Implementation of WebSocketStream for non-multiplexed ws:// connections (or | 26 // Implementation of WebSocketStream for non-multiplexed ws:// connections (or |
27 // the physical side of a multiplexed ws:// connection). | 27 // the physical side of a multiplexed ws:// connection). |
28 class NET_EXPORT_PRIVATE WebSocketBasicStream : public WebSocketStream { | 28 class NET_EXPORT_PRIVATE WebSocketBasicStream : public WebSocketStream { |
29 public: | 29 public: |
30 typedef WebSocketMaskingKey (*WebSocketMaskingKeyGeneratorFunction)(); | 30 typedef WebSocketMaskingKey (*WebSocketMaskingKeyGeneratorFunction)(); |
31 | 31 |
32 // This class should not normally be constructed directly; see | 32 // This class should not normally be constructed directly; see |
33 // WebSocketStream::CreateAndConnectStream() and | 33 // WebSocketStream::CreateAndConnectStream() and |
34 // WebSocketBasicHandshakeStream::Upgrade(). | 34 // WebSocketBasicHandshakeStream::Upgrade(). |
35 WebSocketBasicStream( | 35 WebSocketBasicStream(scoped_ptr<ClientSocketHandle> connection, |
36 scoped_ptr<ClientSocketHandle> connection, | 36 const scoped_refptr<GrowableIOBuffer>& http_read_buffer, |
37 const scoped_refptr<GrowableIOBuffer>& http_read_buffer, | 37 const std::string& sub_protocol, |
38 const std::string& sub_protocol, | 38 const std::string& extensions); |
39 const std::string& extensions); | |
40 | 39 |
41 // The destructor has to make sure the connection is closed when we finish so | 40 // The destructor has to make sure the connection is closed when we finish so |
42 // that it does not get returned to the pool. | 41 // that it does not get returned to the pool. |
43 virtual ~WebSocketBasicStream(); | 42 virtual ~WebSocketBasicStream(); |
44 | 43 |
45 // WebSocketStream implementation. | 44 // WebSocketStream implementation. |
46 virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, | 45 virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, |
47 const CompletionCallback& callback) OVERRIDE; | 46 const CompletionCallback& callback) OVERRIDE; |
48 | 47 |
49 virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, | 48 virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 155 |
157 // This can be overridden in tests to make the output deterministic. We don't | 156 // This can be overridden in tests to make the output deterministic. We don't |
158 // use a Callback here because a function pointer is faster and good enough | 157 // use a Callback here because a function pointer is faster and good enough |
159 // for our purposes. | 158 // for our purposes. |
160 WebSocketMaskingKeyGeneratorFunction generate_websocket_masking_key_; | 159 WebSocketMaskingKeyGeneratorFunction generate_websocket_masking_key_; |
161 }; | 160 }; |
162 | 161 |
163 } // namespace net | 162 } // namespace net |
164 | 163 |
165 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_STREAM_H_ | 164 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_STREAM_H_ |
OLD | NEW |