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

Side by Side Diff: ppapi/cpp/dev/websocket_dev.h

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, 10 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 | « ppapi/c/dev/ppb_websocket_dev.h ('k') | ppapi/cpp/dev/websocket_dev.cc » ('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 #ifndef PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ 5 #ifndef PPAPI_CPP_DEV_WEBSOCKET_DEV_H_
6 #define PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ 6 #define PPAPI_CPP_DEV_WEBSOCKET_DEV_H_
7 7
8 #include "ppapi/c/dev/ppb_websocket_dev.h" 8 #include "ppapi/c/dev/ppb_websocket_dev.h"
9 #include "ppapi/cpp/resource.h" 9 #include "ppapi/cpp/resource.h"
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 int32_t Close(uint16_t code, const Var& reason, 80 int32_t Close(uint16_t code, const Var& reason,
81 const CompletionCallback& callback); 81 const CompletionCallback& callback);
82 82
83 /// ReceiveMessage() receives a message from the WebSocket server. 83 /// ReceiveMessage() receives a message from the WebSocket server.
84 /// This interface only returns a single message. That is, this interface 84 /// This interface only returns a single message. That is, this interface
85 /// must be called at least N times to receive N messages, no matter how 85 /// must be called at least N times to receive N messages, no matter how
86 /// small each message is. 86 /// small each message is.
87 /// 87 ///
88 /// @param[out] message The received message is copied to provided 88 /// @param[out] message The received message is copied to provided
89 /// <code>message</code>. The <code>message</code> must remain valid until 89 /// <code>message</code>. The <code>message</code> must remain valid until
90 /// the ReceiveMessage operation completes. 90 /// the ReceiveMessage operation completes. It will be a <code>Var</code> of
91 /// string or ArrayBuffer types on receiving.
91 /// @param[in] callback A <code>CompletionCallback</code> which is called 92 /// @param[in] callback A <code>CompletionCallback</code> which is called
92 /// when the receiving message is completed. It is ignored if ReceiveMessage 93 /// when the receiving message is completed. It is ignored if ReceiveMessage
93 /// completes synchronously and returns <code>PP_OK</code>. 94 /// completes synchronously and returns <code>PP_OK</code>.
94 /// 95 ///
95 /// @return An int32_t containing an error code from 96 /// @return An int32_t containing an error code from
96 /// <code>pp_errors.h</code>. 97 /// <code>pp_errors.h</code>.
97 /// If an error is detected or connection is closed, returns 98 /// If an error is detected or connection is closed, returns
98 /// <code>PP_ERROR_FAILED</code> after all buffered messages are received. 99 /// <code>PP_ERROR_FAILED</code> after all buffered messages are received.
99 /// Until buffered message become empty, continues to returns 100 /// Until buffered message become empty, continues to returns
100 /// <code>PP_OK</code> as if connection is still established without errors. 101 /// <code>PP_OK</code> as if connection is still established without errors.
101 int32_t ReceiveMessage(Var* message, 102 int32_t ReceiveMessage(Var* message,
102 const CompletionCallback& callback); 103 const CompletionCallback& callback);
103 104
104 /// Send() sends a message to the WebSocket server. 105 /// Send() sends a message to the WebSocket server.
105 /// 106 ///
106 /// @param[in] data A message to send. The message is copied to internal 107 /// @param[in] data A message to send. The message is copied to internal
107 /// buffer. So caller can free <code>data</code> safely after returning 108 /// buffer. So caller can free <code>data</code> safely after returning
108 /// from the function. 109 /// from the function. It must be a <code>Var</code> of string or ArrayBuffer
110 /// types.
109 /// 111 ///
110 /// @return An int32_t containing an error code from 112 /// @return An int32_t containing an error code from
111 /// <code>pp_errors.h</code>. 113 /// <code>pp_errors.h</code>.
112 /// Returns <code>PP_ERROR_FAILED</code> if the ReadyState is 114 /// Returns <code>PP_ERROR_FAILED</code> if the ReadyState is
113 /// <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds 115 /// <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds
114 /// JavaScript InvalidStateError of the specification. 116 /// JavaScript InvalidStateError of the specification.
115 /// Returns <code>PP_ERROR_BADARGUMENT</code> if provided 117 /// Returns <code>PP_ERROR_BADARGUMENT</code> if provided
116 /// <code>message</code> of string type contains an invalid character as a 118 /// <code>message</code> of string type contains an invalid character as a
117 /// UTF-8 string. It corresponds to JavaScript SyntaxError of the 119 /// UTF-8 string. It corresponds to JavaScript SyntaxError of the
118 /// specification. 120 /// specification.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 /// 171 ///
170 /// @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID_DEV</code> if called 172 /// @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID_DEV</code> if called
171 /// before connect() is called. 173 /// before connect() is called.
172 PP_WebSocketReadyState_Dev GetReadyState(); 174 PP_WebSocketReadyState_Dev GetReadyState();
173 175
174 /// GetURL() returns the URL associated with specified WebSocket connection. 176 /// GetURL() returns the URL associated with specified WebSocket connection.
175 /// 177 ///
176 /// @return Returns a <code>Var</code> of string type. If called before the 178 /// @return Returns a <code>Var</code> of string type. If called before the
177 /// connection is established, it contains the empty string. 179 /// connection is established, it contains the empty string.
178 Var GetURL(); 180 Var GetURL();
179
180 /// SetBinaryType() specifies the binary object type for receiving binary
181 /// frames representation. Receiving text frames are always mapped to
182 /// <PP_VARTYPE_STRING</code> var regardless of this attribute.
183 /// This function should be called before Connect() to ensure receiving all
184 /// incoming binary frames as the specified binary object type.
185 /// Default type is <code>PP_WEBSOCKETBINARYTYPE_BLOB_DEV</code>.
186 ///
187 /// Currently, Blob bindings is not supported in Pepper, so receiving binary
188 /// type is always ArrayBuffer. To ensure backward compatibility, you must
189 /// call this function with
190 /// <code>PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV</code> to use binary frames.
191 ///
192 /// @param[in] binary_type Binary object type for receiving binary frames
193 /// representation.
194 ///
195 /// @return Returns <code>false</code> if the specified type is not
196 /// supported. Otherwise, returns <code>true</code>.
197 ///
198 bool SetBinaryType(PP_WebSocketBinaryType_Dev binary_type);
199
200 /// GetBinaryType() returns the currently specified binary object type for
201 /// receiving binary frames.
202 ///
203 /// @return Returns <code>PP_WebSocketBinaryType_Dev</code> represents the
204 /// current binary object type.
205 PP_WebSocketBinaryType_Dev GetBinaryType();
206 }; 181 };
207 182
208 } // namespace pp 183 } // namespace pp
209 184
210 #endif // PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ 185 #endif // PPAPI_CPP_DEV_WEBSOCKET_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_websocket_dev.h ('k') | ppapi/cpp/dev/websocket_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698