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

Side by Side Diff: ppapi/api/dev/ppb_websocket_dev.idl

Issue 9296001: WebSocket Pepper API: Remove binary type handling interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_websocket_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 /** 6 /**
7 * This file defines the <code>PPB_WebSocket_Dev</code> interface. 7 * This file defines the <code>PPB_WebSocket_Dev</code> interface.
8 */ 8 */
9 label Chrome { 9 label Chrome {
10 M17 = 0.1, 10 M17 = 0.1
11 M18 = 0.9
12 }; 11 };
13 12
14 13
15 /** 14 /**
16 * This enumeration contains the types representing the WebSocket ready state 15 * This enumeration contains the types representing the WebSocket ready state
17 * and these states are based on the JavaScript WebSocket API specification. 16 * and these states are based on the JavaScript WebSocket API specification.
18 * GetReadyState() returns one of these states. 17 * GetReadyState() returns one of these states.
19 */ 18 */
20 [assert_size(4)] 19 [assert_size(4)]
21 enum PP_WebSocketReadyState_Dev { 20 enum PP_WebSocketReadyState_Dev {
(...skipping 16 matching lines...) Expand all
38 * Ready state that the connection is going through the closing handshake. 37 * Ready state that the connection is going through the closing handshake.
39 */ 38 */
40 PP_WEBSOCKETREADYSTATE_CLOSING_DEV = 2, 39 PP_WEBSOCKETREADYSTATE_CLOSING_DEV = 2,
41 40
42 /** 41 /**
43 * Ready state that the connection has been closed or could not be opened. 42 * Ready state that the connection has been closed or could not be opened.
44 */ 43 */
45 PP_WEBSOCKETREADYSTATE_CLOSED_DEV = 3 44 PP_WEBSOCKETREADYSTATE_CLOSED_DEV = 3
46 }; 45 };
47 46
48 /**
49 * This enumeration contains the types representing the WebSocket binary type
50 * to receive frames. These types are based on the JavaScript WebSocket API
51 * specification.
52 */
53 [assert_size(4)]
54 enum PP_WebSocketBinaryType_Dev {
55 /**
56 * Binary type is queried on an invalid resource.
57 */
58 PP_WEBSOCKETBINARYTYPE_INVALID = -1,
59
60 /**
61 * Binary type that represents Blob objects.
62 */
63 PP_WEBSOCKETBINARYTYPE_BLOB_DEV = 0,
64
65 /**
66 * Binary type that represents ArrayBuffer objects.
67 */
68 PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV = 1
69 };
70
71 interface PPB_WebSocket_Dev { 47 interface PPB_WebSocket_Dev {
72 /** 48 /**
73 * Create() creates a WebSocket instance. 49 * Create() creates a WebSocket instance.
74 * 50 *
75 * @param[in] instance A <code>PP_Instance</code> identifying the instance 51 * @param[in] instance A <code>PP_Instance</code> identifying the instance
76 * with the WebSocket. 52 * with the WebSocket.
77 * 53 *
78 * @return A <code>PP_Resource</code> corresponding to a WebSocket if 54 * @return A <code>PP_Resource</code> corresponding to a WebSocket if
79 * successful. 55 * successful.
80 */ 56 */
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 * ReceiveMessage() receives a message from the WebSocket server. 149 * ReceiveMessage() receives a message from the WebSocket server.
174 * This interface only returns a single message. That is, this interface must 150 * This interface only returns a single message. That is, this interface must
175 * be called at least N times to receive N messages, no matter how small each 151 * be called at least N times to receive N messages, no matter how small each
176 * message is. 152 * message is.
177 * 153 *
178 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a 154 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
179 * WebSocket. 155 * WebSocket.
180 * 156 *
181 * @param[out] message The received message is copied to provided 157 * @param[out] message The received message is copied to provided
182 * <code>message</code>. The <code>message</code> must remain valid until 158 * <code>message</code>. The <code>message</code> must remain valid until
183 * the ReceiveMessage operation completes. 159 * the ReceiveMessage operation completes. Its <code>PP_VarType</code>
160 * will be <code>PP_VARTYPE_STRING</code> or
161 * <code>PP_VARTYPE_ARRAY_BYFFER</code> on receiving.
184 * 162 *
185 * @param[in] callback A <code>PP_CompletionCallback</code> which is called 163 * @param[in] callback A <code>PP_CompletionCallback</code> which is called
186 * when the receiving message is completed. It is ignored if ReceiveMessage 164 * when the receiving message is completed. It is ignored if ReceiveMessage
187 * completes synchronously and returns <code>PP_OK</code>. 165 * completes synchronously and returns <code>PP_OK</code>.
188 * 166 *
189 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 167 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
190 * If an error is detected or connection is closed, returns 168 * If an error is detected or connection is closed, returns
191 * <code>PP_ERROR_FAILED</code> after all buffered messages are received. 169 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
192 * Until buffered message become empty, continues to returns 170 * Until buffered message become empty, continues to returns
193 * <code>PP_OK</code> as if connection is still established without errors. 171 * <code>PP_OK</code> as if connection is still established without errors.
194 */ 172 */
195 int32_t ReceiveMessage([in] PP_Resource web_socket, 173 int32_t ReceiveMessage([in] PP_Resource web_socket,
196 [out] PP_Var message, 174 [out] PP_Var message,
197 [in] PP_CompletionCallback callback); 175 [in] PP_CompletionCallback callback);
198 176
199 /** 177 /**
200 * SendMessage() sends a message to the WebSocket server. 178 * SendMessage() sends a message to the WebSocket server.
201 * 179 *
202 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a 180 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
203 * WebSocket. 181 * WebSocket.
204 * 182 *
205 * @param[in] message A message to send. The message is copied to internal 183 * @param[in] message A message to send. The message is copied to internal
206 * buffer. So caller can free <code>message</code> safely after returning 184 * buffer. So caller can free <code>message</code> safely after returning
207 * from the function. 185 * from the function. Its <code>PP_VarType</code> must be
186 * <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>.
208 * 187 *
209 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 188 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
210 * Returns <code>PP_ERROR_FAILED</code> if the ReadyState is 189 * Returns <code>PP_ERROR_FAILED</code> if the ReadyState is
211 * <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds 190 * <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds
212 * JavaScript InvalidStateError of the specification. 191 * JavaScript InvalidStateError of the specification.
213 * Returns <code>PP_ERROR_BADARGUMENT</code> if provided <code>message</code> 192 * Returns <code>PP_ERROR_BADARGUMENT</code> if provided <code>message</code>
214 * of string type contains an invalid character as a UTF-8 string. It 193 * of string type contains an invalid character as a UTF-8 string. It
215 * corresponds to JavaScript SyntaxError of the specification. 194 * corresponds to JavaScript SyntaxError of the specification.
216 * Otherwise, returns <code>PP_OK</code>, but it doesn't necessarily mean 195 * Otherwise, returns <code>PP_OK</code>, but it doesn't necessarily mean
217 * that the server received the message. 196 * that the server received the message.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 * GetURL() returns the URL associated with specified WebSocket connection. 291 * GetURL() returns the URL associated with specified WebSocket connection.
313 * 292 *
314 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a 293 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
315 * WebSocket. 294 * WebSocket.
316 * 295 *
317 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the 296 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the
318 * connection is established, it contains the empty string. Return a 297 * connection is established, it contains the empty string. Return a
319 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. 298 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource.
320 */ 299 */
321 PP_Var GetURL([in] PP_Resource web_socket); 300 PP_Var GetURL([in] PP_Resource web_socket);
322
323 /**
324 * SetBinaryType() specifies the binary object type for receiving binary
325 * frames representation. Receiving text frames are always mapped to
326 * <PP_VARTYPE_STRING</code> var regardless of this attribute.
327 * This function should be called before Connect() to ensure receiving all
328 * incoming binary frames as the specified binary object type.
329 * Default type is <code>PP_WEBSOCKETBINARYTYPE_BLOB_DEV</code>.
330 *
331 * Currently, Blob bindings is not supported in Pepper, so receiving binary
332 * type is always ArrayBuffer. To ensure backward compatibility, you must
333 * call this function with
334 * <code>PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV</code> to use binary frames.
335 *
336 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
337 * WebSocket.
338 *
339 * @param[in] binary_type Binary object type for receiving binary frames
340 * representation.
341 *
342 * @return Returns <code>PP_FALSE</code> if the specified type is not
343 * supported. Otherwise, returns <code>PP_TRUE</code>.
344 */
345 [version=0.9]
346 PP_Bool SetBinaryType([in] PP_Resource web_socket,
347 [in] PP_WebSocketBinaryType_Dev binary_type);
348
349 /**
350 * GetBinaryType() returns the currently specified binary object type for
351 * receiving binary frames.
352 *
353 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
354 * WebSocket.
355 *
356 * @return Returns <code>PP_WebSocketBinaryType_Dev</code> represents the
357 * current binary object type.
358 */
359 [version=0.9]
360 PP_WebSocketBinaryType_Dev GetBinaryType([in] PP_Resource web_socket);
361 }; 301 };
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_websocket_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698