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

Unified Diff: ppapi/c/ppb_websocket.h

Issue 9192009: WebSocket Pepper API: make the API out of dev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove binary type handling interfaces 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/c/ppb_websocket.h
diff --git a/ppapi/c/dev/ppb_websocket_dev.h b/ppapi/c/ppb_websocket.h
similarity index 70%
rename from ppapi/c/dev/ppb_websocket_dev.h
rename to ppapi/c/ppb_websocket.h
index e138f2b9ca593d18e46736bc557bf82533a4829e..f1fae672a81267f8768079ec28fd77ac07f11ac7 100644
--- a/ppapi/c/dev/ppb_websocket_dev.h
+++ b/ppapi/c/ppb_websocket.h
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_websocket_dev.idl modified Wed Jan 18 20:17:45 2012. */
+/* From ppb_websocket.idl modified Thu Jan 26 14:29:58 2012. */
-#ifndef PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_
-#define PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_
+#ifndef PPAPI_C_PPB_WEBSOCKET_H_
+#define PPAPI_C_PPB_WEBSOCKET_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
@@ -16,13 +16,12 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
-#define PPB_WEBSOCKET_DEV_INTERFACE_0_1 "PPB_WebSocket(Dev);0.1"
-#define PPB_WEBSOCKET_DEV_INTERFACE_0_9 "PPB_WebSocket(Dev);0.9"
-#define PPB_WEBSOCKET_DEV_INTERFACE PPB_WEBSOCKET_DEV_INTERFACE_0_9
+#define PPB_WEBSOCKET_INTERFACE_1_0 "PPB_WebSocket;1.0"
+#define PPB_WEBSOCKET_INTERFACE PPB_WEBSOCKET_INTERFACE_1_0
/**
* @file
- * This file defines the <code>PPB_WebSocket_Dev</code> interface.
+ * This file defines the <code>PPB_WebSocket</code> interface.
*/
@@ -39,47 +38,26 @@ typedef enum {
/**
* Ready state is queried on an invalid resource.
*/
- PP_WEBSOCKETREADYSTATE_INVALID_DEV = -1,
+ PP_WEBSOCKETREADYSTATE_INVALID = -1,
/**
* Ready state that the connection has not yet been established.
*/
- PP_WEBSOCKETREADYSTATE_CONNECTING_DEV = 0,
+ PP_WEBSOCKETREADYSTATE_CONNECTING = 0,
/**
* Ready state that the WebSocket connection is established and communication
* is possible.
*/
- PP_WEBSOCKETREADYSTATE_OPEN_DEV = 1,
+ PP_WEBSOCKETREADYSTATE_OPEN = 1,
/**
* Ready state that the connection is going through the closing handshake.
*/
- PP_WEBSOCKETREADYSTATE_CLOSING_DEV = 2,
+ PP_WEBSOCKETREADYSTATE_CLOSING = 2,
/**
* Ready state that the connection has been closed or could not be opened.
*/
- PP_WEBSOCKETREADYSTATE_CLOSED_DEV = 3
-} PP_WebSocketReadyState_Dev;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketReadyState_Dev, 4);
-
-/**
- * This enumeration contains the types representing the WebSocket binary type
- * to receive frames. These types are based on the JavaScript WebSocket API
- * specification.
- */
-typedef enum {
- /**
- * Binary type is queried on an invalid resource.
- */
- PP_WEBSOCKETBINARYTYPE_INVALID = -1,
- /**
- * Binary type that represents Blob objects.
- */
- PP_WEBSOCKETBINARYTYPE_BLOB_DEV = 0,
- /**
- * Binary type that represents ArrayBuffer objects.
- */
- PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV = 1
-} PP_WebSocketBinaryType_Dev;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketBinaryType_Dev, 4);
+ PP_WEBSOCKETREADYSTATE_CLOSED = 3
+} PP_WebSocketReadyState;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketReadyState, 4);
/**
* @}
*/
@@ -88,7 +66,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketBinaryType_Dev, 4);
* @addtogroup Interfaces
* @{
*/
-struct PPB_WebSocket_Dev_0_9 {
+struct PPB_WebSocket_1_0 {
/**
* Create() creates a WebSocket instance.
*
@@ -107,9 +85,9 @@ struct PPB_WebSocket_Dev_0_9 {
* WebSocket.
*
* @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
- * <code>PPB_WebSocket_Dev</code>, <code>PP_FALSE</code> if the
+ * <code>PPB_WebSocket</code>, <code>PP_FALSE</code> if the
* <code>resource</code> is invalid or some type other than
- * <code>PPB_WebSocket_Dev</code>.
+ * <code>PPB_WebSocket</code>.
*/
PP_Bool (*IsWebSocket)(PP_Resource resource);
/**
@@ -196,7 +174,9 @@ struct PPB_WebSocket_Dev_0_9 {
*
* @param[out] message The received message is copied to provided
* <code>message</code>. The <code>message</code> must remain valid until
- * the ReceiveMessage operation completes.
+ * the ReceiveMessage operation completes. Its <code>PP_VarType</code>
+ * will be <code>PP_VARTYPE_STRING</code> or
+ * <code>PP_VARTYPE_ARRAY_BUFFER</code> on receiving.
*
* @param[in] callback A <code>PP_CompletionCallback</code> which is called
* when the receiving message is completed. It is ignored if ReceiveMessage
@@ -219,12 +199,13 @@ struct PPB_WebSocket_Dev_0_9 {
*
* @param[in] message A message to send. The message is copied to internal
* buffer. So caller can free <code>message</code> safely after returning
- * from the function.
+ * from the function. Its <code>PP_VarType</code> must be
+ * <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_FAILED</code> if the ReadyState is
- * <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds
- * JavaScript InvalidStateError of the specification.
+ * <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code>. It corresponds JavaScript
+ * InvalidStateError of the specification.
* Returns <code>PP_ERROR_BADARGUMENT</code> if provided <code>message</code>
* of string type contains an invalid character as a UTF-8 string. It
* corresponds to JavaScript SyntaxError of the specification.
@@ -310,10 +291,10 @@ struct PPB_WebSocket_Dev_0_9 {
* @param[in] web_socket A <code>PP_Resource</code> corresponding to a
* WebSocket.
*
- * @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID_DEV</code> if called
+ * @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID</code> if called
* before connect() is called, or called on an invalid resource.
*/
- PP_WebSocketReadyState_Dev (*GetReadyState)(PP_Resource web_socket);
+ PP_WebSocketReadyState (*GetReadyState)(PP_Resource web_socket);
/**
* GetURL() returns the URL associated with specified WebSocket connection.
*
@@ -325,73 +306,12 @@ struct PPB_WebSocket_Dev_0_9 {
* <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource.
*/
struct PP_Var (*GetURL)(PP_Resource web_socket);
- /**
- * SetBinaryType() specifies the binary object type for receiving binary
- * frames representation. Receiving text frames are always mapped to
- * <PP_VARTYPE_STRING</code> var regardless of this attribute.
- * This function should be called before Connect() to ensure receiving all
- * incoming binary frames as the specified binary object type.
- * Default type is <code>PP_WEBSOCKETBINARYTYPE_BLOB_DEV</code>.
- *
- * Currently, Blob bindings is not supported in Pepper, so receiving binary
- * type is always ArrayBuffer. To ensure backward compatibility, you must
- * call this function with
- * <code>PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV</code> to use binary frames.
- *
- * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
- * WebSocket.
- *
- * @param[in] binary_type Binary object type for receiving binary frames
- * representation.
- *
- * @return Returns <code>PP_FALSE</code> if the specified type is not
- * supported. Otherwise, returns <code>PP_TRUE</code>.
- */
- PP_Bool (*SetBinaryType)(PP_Resource web_socket,
- PP_WebSocketBinaryType_Dev binary_type);
- /**
- * GetBinaryType() returns the currently specified binary object type for
- * receiving binary frames.
- *
- * @param[in] web_socket A <code>PP_Resource</code> corresponding to a
- * WebSocket.
- *
- * @return Returns <code>PP_WebSocketBinaryType_Dev</code> represents the
- * current binary object type.
- */
- PP_WebSocketBinaryType_Dev (*GetBinaryType)(PP_Resource web_socket);
};
-typedef struct PPB_WebSocket_Dev_0_9 PPB_WebSocket_Dev;
-
-struct PPB_WebSocket_Dev_0_1 {
- PP_Resource (*Create)(PP_Instance instance);
- PP_Bool (*IsWebSocket)(PP_Resource resource);
- int32_t (*Connect)(PP_Resource web_socket,
- struct PP_Var url,
- const struct PP_Var protocols[],
- uint32_t protocol_count,
- struct PP_CompletionCallback callback);
- int32_t (*Close)(PP_Resource web_socket,
- uint16_t code,
- struct PP_Var reason,
- struct PP_CompletionCallback callback);
- int32_t (*ReceiveMessage)(PP_Resource web_socket,
- struct PP_Var* message,
- struct PP_CompletionCallback callback);
- int32_t (*SendMessage)(PP_Resource web_socket, struct PP_Var message);
- uint64_t (*GetBufferedAmount)(PP_Resource web_socket);
- uint16_t (*GetCloseCode)(PP_Resource web_socket);
- struct PP_Var (*GetCloseReason)(PP_Resource web_socket);
- PP_Bool (*GetCloseWasClean)(PP_Resource web_socket);
- struct PP_Var (*GetExtensions)(PP_Resource web_socket);
- struct PP_Var (*GetProtocol)(PP_Resource web_socket);
- PP_WebSocketReadyState_Dev (*GetReadyState)(PP_Resource web_socket);
- struct PP_Var (*GetURL)(PP_Resource web_socket);
-};
+typedef struct PPB_WebSocket_1_0 PPB_WebSocket;
/**
* @}
*/
-#endif /* PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_ */
+#endif /* PPAPI_C_PPB_WEBSOCKET_H_ */

Powered by Google App Engine
This is Rietveld 408576698