Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: net/websockets/websocket_stream.h

Issue 23685005: Clarify the specification of WriteFrames() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_stream.h
diff --git a/net/websockets/websocket_stream.h b/net/websockets/websocket_stream.h
index 6c2a4ff8ef1c262e31e7e01435bba9e8394519a9..4885bbe729541894c65ee18b2fdf312271348b26 100644
--- a/net/websockets/websocket_stream.h
+++ b/net/websockets/websocket_stream.h
@@ -92,7 +92,7 @@ class NET_EXPORT_PRIVATE WebSocketStream : public WebSocketStreamBase {
// Reads WebSocket frame data. This operation finishes when new frame data
// becomes available. Each frame message might be chopped off in the middle
- // as specified in the description of WebSocketFrameChunk struct.
+ // as specified in the description of the WebSocketFrameChunk struct.
// |frame_chunks| remains owned by the caller and must be valid until the
// operation completes or Close() is called. |frame_chunks| must be empty on
// calling.
@@ -127,19 +127,22 @@ class NET_EXPORT_PRIVATE WebSocketStream : public WebSocketStreamBase {
virtual int ReadFrames(ScopedVector<WebSocketFrameChunk>* frame_chunks,
const CompletionCallback& callback) = 0;
- // Writes WebSocket frame data. |frame_chunks| must obey the rule specified
- // in the documentation of WebSocketFrameChunk struct: the first chunk of
- // a WebSocket frame must contain non-NULL |header|, and the last chunk must
- // have |final_chunk| field set to true. Series of chunks representing a
- // WebSocket frame must be consistent (the total length of |data| fields must
- // match |header->payload_length|). |frame_chunks| must be valid until the
- // operation completes or Close() is called.
+ // Writes WebSocket frame data. |frame_chunks| must only contain complete
+ // frames. Every chunk must have a non-NULL |header| and the |final_chunk|
+ // boolean set to true.
//
- // This function should not be called while previous call of WriteFrames() is
- // still pending.
+ // The |frame_chunks| pointer must remain valid until the operation completes
+ // or Close() is called. WriteFrames() will modify the contents of
+ // |frame_chunks| in the process of sending the message. After WriteFrames()
+ // has completed it is safe to clear and then re-use the vector, but other
+ // than that the caller should make no assumptions about its contents.
//
- // Support for incomplete frames is not guaranteed and may be removed from
- // future iterations of the API.
+ // This function should not be called while a previous call to WriteFrames()
+ // on the same stream is pending.
+ //
+ // Frame boundaries may not be preserved. Frames may be split or
+ // coalesced. Message boundaries are preserved (as required by WebSocket API
+ // semantics).
//
// This method will only return OK if all frames were written completely.
// Otherwise it will return an appropriate net error code.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698