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 #ifndef NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // If the connection is closed in the middle of receiving an incomplete frame, | 127 // If the connection is closed in the middle of receiving an incomplete frame, |
128 // ReadFrames may discard the incomplete frame. Since the renderer will | 128 // ReadFrames may discard the incomplete frame. Since the renderer will |
129 // discard any incomplete messages when the connection is closed, this makes | 129 // discard any incomplete messages when the connection is closed, this makes |
130 // no difference to the overall semantics. | 130 // no difference to the overall semantics. |
131 // | 131 // |
132 // Implementations of ReadFrames() must be able to handle being deleted during | 132 // Implementations of ReadFrames() must be able to handle being deleted during |
133 // the execution of callback.Run(). In practice this means that the method | 133 // the execution of callback.Run(). In practice this means that the method |
134 // calling callback.Run() (and any calling methods in the same object) must | 134 // calling callback.Run() (and any calling methods in the same object) must |
135 // return immediately without any further method calls or access to member | 135 // return immediately without any further method calls or access to member |
136 // variables. Implementors should write test(s) for this case. | 136 // variables. Implementors should write test(s) for this case. |
| 137 // |
| 138 // Extensions which use reserved header bits should clear them when they are |
| 139 // set correctly. If the reserved header bits are set incorrectly, it is okay |
| 140 // to leave it to the caller to report the error. |
137 virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, | 141 virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, |
138 const CompletionCallback& callback) = 0; | 142 const CompletionCallback& callback) = 0; |
139 | 143 |
140 // Writes WebSocket frame data. | 144 // Writes WebSocket frame data. |
141 // | 145 // |
142 // |frames| must be valid until the operation completes or Close() is called. | 146 // |frames| must be valid until the operation completes or Close() is called. |
143 // | 147 // |
144 // This function must not be called while a previous call of WriteFrames() is | 148 // This function must not be called while a previous call of WriteFrames() is |
145 // still pending. | 149 // still pending. |
146 // | 150 // |
(...skipping 29 matching lines...) Expand all Loading... |
176 protected: | 180 protected: |
177 WebSocketStream(); | 181 WebSocketStream(); |
178 | 182 |
179 private: | 183 private: |
180 DISALLOW_COPY_AND_ASSIGN(WebSocketStream); | 184 DISALLOW_COPY_AND_ASSIGN(WebSocketStream); |
181 }; | 185 }; |
182 | 186 |
183 } // namespace net | 187 } // namespace net |
184 | 188 |
185 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 189 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
OLD | NEW |