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

Side by Side Diff: content/common/websocket_messages.h

Issue 1568523002: Implement content::WebSocketBlobSender (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@websocket_blob_send_ipcs
Patch Set: Use the real net::TestCompletionCallback. Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 // Multiply-included message file, hence no include guard. 5 // Multiply-included message file, hence no include guard.
6 6
7 // This file defines the IPCs for the browser-side implementation of 7 // This file defines the IPCs for the browser-side implementation of
8 // WebSockets. 8 // WebSockets.
9 // 9 //
10 // This IPC interface was originally desined based on the WebSocket 10 // This IPC interface was originally desined based on the WebSocket
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Open new WebSocket connection to |socket_url|. |requested_protocols| is a 67 // Open new WebSocket connection to |socket_url|. |requested_protocols| is a
68 // list of tokens identifying sub-protocols the renderer would like to use, as 68 // list of tokens identifying sub-protocols the renderer would like to use, as
69 // described in RFC6455 "Subprotocols Using the WebSocket Protocol". 69 // described in RFC6455 "Subprotocols Using the WebSocket Protocol".
70 IPC_MESSAGE_ROUTED4(WebSocketHostMsg_AddChannelRequest, 70 IPC_MESSAGE_ROUTED4(WebSocketHostMsg_AddChannelRequest,
71 GURL /* socket_url */, 71 GURL /* socket_url */,
72 std::vector<std::string> /* requested_protocols */, 72 std::vector<std::string> /* requested_protocols */,
73 url::Origin /* origin */, 73 url::Origin /* origin */,
74 int /* render_frame_id */) 74 int /* render_frame_id */)
75 75
76 // Send a complete binary WebSocket message consisting of the Blob identified by
77 // |uuid|. The message will be split into frames as necessary. |expected_size|
78 // must match the browser's idea of the size of the Blob to prevent flow control
79 // from becoming desynchronised. If it does not match the connection will be
80 // terminated with a WebSocketMsg_NotifyFailure message. On success, the browser
81 // will have consumed |expected_size| bytes of flow control send quota and the
82 // renderer needs to subtract that from its running total of flow control send
83 // quota. See the design doc at
84 // https://docs.google.com/document/d/1CDiXB9pBumhFVVfmIn1CRI6v6byxyqWu2urEE9xp7 14/edit
85 // SendFrame or SendBlob IPCs must not be sent by the renderer until the
86 // BlobSendComplete message has been received from the browser. The renderer
87 // should retain a reference to the Blob until either a BlobSendComplete or
88 // NotifyFailure IPC is received.
89 IPC_MESSAGE_ROUTED2(WebSocketHostMsg_SendBlob,
90 std::string /* uuid */,
91 uint64_t /* expected_size */)
92
76 // WebSocket messages sent from the browser to the renderer. 93 // WebSocket messages sent from the browser to the renderer.
77 94
78 // Respond to an AddChannelRequest. |selected_protocol| is the sub-protocol the 95 // Respond to an AddChannelRequest. |selected_protocol| is the sub-protocol the
79 // server selected, or empty if no sub-protocol was selected. |extensions| is 96 // server selected, or empty if no sub-protocol was selected. |extensions| is
80 // the list of extensions negotiated for the connection. 97 // the list of extensions negotiated for the connection.
81 IPC_MESSAGE_ROUTED2(WebSocketMsg_AddChannelResponse, 98 IPC_MESSAGE_ROUTED2(WebSocketMsg_AddChannelResponse,
82 std::string /* selected_protocol */, 99 std::string /* selected_protocol */,
83 std::string /* extensions */) 100 std::string /* extensions */)
84 101
85 // Notify the renderer that the browser has started an opening handshake. 102 // Notify the renderer that the browser has started an opening handshake.
(...skipping 18 matching lines...) Expand all
104 // 1. Fire an error event. 121 // 1. Fire an error event.
105 // 2. Show |message| to the inspector. 122 // 2. Show |message| to the inspector.
106 // 3. Close the channel immediately uncleanly, as if it received 123 // 3. Close the channel immediately uncleanly, as if it received
107 // DropChannel(was_clean = false, code = 1006, reason = ""). 124 // DropChannel(was_clean = false, code = 1006, reason = "").
108 // |message| will be shown in the inspector and won't be passed to the script. 125 // |message| will be shown in the inspector and won't be passed to the script.
109 // TODO(yhirano): Find the way to pass |message| directly to the inspector 126 // TODO(yhirano): Find the way to pass |message| directly to the inspector
110 // process. 127 // process.
111 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, 128 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure,
112 std::string /* message */) 129 std::string /* message */)
113 130
131 // Indicates tbat the current Blob has finished sending. The renderer can
132 // release its reference on the Blob, and may now use SendFrame or SendBlob to
133 // send more messages.
134 IPC_MESSAGE_ROUTED0(WebSocketMsg_BlobSendComplete);
135
114 // WebSocket messages that can be sent in either direction. 136 // WebSocket messages that can be sent in either direction.
115 137
116 // Send a non-control frame to the channel. 138 // Send a non-control frame to the channel.
117 // - If the sender is the renderer, it will be sent to the remote server. 139 // - If the sender is the renderer, it will be sent to the remote server.
118 // - If the sender is the browser, it comes from the remote server. 140 // - If the sender is the browser, it comes from the remote server.
119 // 141 //
120 // - |fin| indicates that this frame is the last in the current message. 142 // - |fin| indicates that this frame is the last in the current message.
121 // - |type| is the type of the message. On the first frame of a message, it 143 // - |type| is the type of the message. On the first frame of a message, it
122 // must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or 144 // must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or
123 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to 145 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to
124 // WEB_SOCKET_MESSAGE_TYPE_CONTINUATION, and the type is the same as that of 146 // WEB_SOCKET_MESSAGE_TYPE_CONTINUATION, and the type is the same as that of
125 // the first message. If |type| is WEB_SOCKET_MESSAGE_TYPE_TEXT, then the 147 // the first message. If |type| is WEB_SOCKET_MESSAGE_TYPE_TEXT, then the
126 // concatenation of the |data| from every frame in the message must be valid 148 // concatenation of the |data| from every frame in the message must be valid
127 // UTF-8. If |fin| is not set, |data| must be non-empty. 149 // UTF-8. If |fin| is not set, |data| must be non-empty.
128 IPC_MESSAGE_ROUTED3(WebSocketMsg_SendFrame, 150 IPC_MESSAGE_ROUTED3(WebSocketMsg_SendFrame,
129 bool /* fin */, 151 bool /* fin */,
130 content::WebSocketMessageType /* type */, 152 content::WebSocketMessageType /* type */,
131 std::vector<char> /* data */) 153 std::vector<char> /* data */)
132 154
133 // Add |quota| tokens of send quota for the channel. |quota| must be a positive 155 // Add |quota| tokens of send quota for the channel. |quota| must be a positive
134 // integer. Both the browser and the renderer set send quota for the other 156 // integer. Both the browser and the renderer set send quota for the other
135 // side, and check that quota has not been exceeded when receiving messages. 157 // side, and check that quota has not been exceeded when receiving messages.
136 // Both sides start a new channel with a quota of 0, and must wait for a 158 // Both sides start a new channel with a quota of 0, and must wait for a
137 // FlowControl message before calling SendFrame. The total available quota on 159 // FlowControl message before calling SendFrame. The total available quota on
138 // one side must never exceed 0x7FFFFFFFFFFFFFFF tokens. 160 // one side must never exceed 0x7FFFFFFFFFFFFFFF tokens.
139 IPC_MESSAGE_ROUTED1(WebSocketMsg_FlowControl, int64_t /* quota */) 161 IPC_MESSAGE_ROUTED1(WebSocketMsg_FlowControl, int64_t /* quota */)
yhirano 2016/01/25 10:52:23 Should we write something that in blob-sending mod
Adam Rice 2016/01/25 23:04:01 I added some new text. Please take a look and see
140 162
141 // Drop the channel. 163 // Drop the channel.
142 // 164 //
143 // When sent by the renderer, this will cause a Close message will be sent and 165 // When sent by the renderer, this will cause a Close message will be sent and
144 // the TCP/IP connection will be closed. 166 // the TCP/IP connection will be closed.
145 // 167 //
146 // When sent by the browser, this indicates that a Close has been received, the 168 // When sent by the browser, this indicates that a Close has been received, the
147 // connection was closed, or a network or protocol error occurred. 169 // connection was closed, or a network or protocol error occurred.
148 // 170 //
149 // - |code| is one of the reason codes specified in RFC6455. 171 // - |code| is one of the reason codes specified in RFC6455.
150 // - |reason|, if non-empty, is a UTF-8 encoded string which may be useful for 172 // - |reason|, if non-empty, is a UTF-8 encoded string which may be useful for
151 // debugging but is not necessarily human-readable, as supplied by the server 173 // debugging but is not necessarily human-readable, as supplied by the server
152 // in the Close message. 174 // in the Close message.
153 // - If |was_clean| is false on a message from the browser, then the WebSocket 175 // - If |was_clean| is false on a message from the browser, then the WebSocket
154 // connection was not closed cleanly. If |was_clean| is false on a message 176 // connection was not closed cleanly. If |was_clean| is false on a message
155 // from the renderer, then the connection should be closed immediately without 177 // from the renderer, then the connection should be closed immediately without
156 // a closing handshake and the renderer cannot accept any new messages on this 178 // a closing handshake and the renderer cannot accept any new messages on this
157 // connection. 179 // connection.
158 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, 180 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel,
159 bool /* was_clean */, 181 bool /* was_clean */,
160 unsigned short /* code */, 182 unsigned short /* code */,
161 std::string /* reason */) 183 std::string /* reason */)
162 184
163 // Notify the renderer that a closing handshake has been initiated by the 185 // Notify the renderer that a closing handshake has been initiated by the
164 // server, so that it can set the Javascript readyState to CLOSING. 186 // server, so that it can set the Javascript readyState to CLOSING.
165 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) 187 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698