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

Side by Side Diff: ppapi/thunk/ppb_websocket_api.h

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated TestURLLoader to test blocking callbacks. Created 8 years, 8 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
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_THUNK_WEBSOCKET_API_H_ 5 #ifndef PPAPI_THUNK_WEBSOCKET_API_H_
6 #define PPAPI_THUNK_WEBSOCKET_API_H_ 6 #define PPAPI_THUNK_WEBSOCKET_API_H_
7 7
8 #include "ppapi/c/pp_completion_callback.h" 8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/ppb_websocket.h" 9 #include "ppapi/c/ppb_websocket.h"
10 #include "ppapi/shared_impl/api_callback_type.h"
10 11
11 namespace ppapi { 12 namespace ppapi {
12 namespace thunk { 13 namespace thunk {
13 14
14 // Some arguments and attributes are based on The WebSocket Protocol and The 15 // Some arguments and attributes are based on The WebSocket Protocol and The
15 // WebSocket API. See also following official specifications. 16 // WebSocket API. See also following official specifications.
16 // - The WebSocket Protocol http://tools.ietf.org/html/rfc6455 17 // - The WebSocket Protocol http://tools.ietf.org/html/rfc6455
17 // - The WebSocket API http://dev.w3.org/html5/websockets/ 18 // - The WebSocket API http://dev.w3.org/html5/websockets/
18 class PPB_WebSocket_API { 19 class PPB_WebSocket_API {
19 public: 20 public:
20 virtual ~PPB_WebSocket_API() {} 21 virtual ~PPB_WebSocket_API() {}
21 22
22 // Connects to the specified WebSocket server with |protocols| argument 23 // Connects to the specified WebSocket server with |protocols| argument
23 // defined by the WebSocket API. Returns an int32_t error code from 24 // defined by the WebSocket API. Returns an int32_t error code from
24 // pp_errors.h. 25 // pp_errors.h.
25 virtual int32_t Connect(PP_Var url, 26 virtual int32_t Connect(PP_Var url,
26 const PP_Var protocols[], 27 const PP_Var protocols[],
27 uint32_t protocol_count, 28 uint32_t protocol_count,
28 PP_CompletionCallback callback) = 0; 29 ApiCallbackType callback) = 0;
29 30
30 // Closes the established connection with specified |code| and |reason|. 31 // Closes the established connection with specified |code| and |reason|.
31 // Returns an int32_t error code from pp_errors.h. 32 // Returns an int32_t error code from pp_errors.h.
32 virtual int32_t Close(uint16_t code, 33 virtual int32_t Close(uint16_t code,
33 PP_Var reason, 34 PP_Var reason,
34 PP_CompletionCallback callback) = 0; 35 ApiCallbackType callback) = 0;
35 36
36 // Receives a message from the WebSocket server. Caller must keep specified 37 // Receives a message from the WebSocket server. Caller must keep specified
37 // |message| object as valid until completion callback is invoked. Returns an 38 // |message| object as valid until completion callback is invoked. Returns an
38 // int32_t error code from pp_errors.h. 39 // int32_t error code from pp_errors.h.
39 virtual int32_t ReceiveMessage(PP_Var* message, 40 virtual int32_t ReceiveMessage(PP_Var* message,
40 PP_CompletionCallback callback) = 0; 41 ApiCallbackType callback) = 0;
41 42
42 // Sends a message to the WebSocket server. Returns an int32_t error code 43 // Sends a message to the WebSocket server. Returns an int32_t error code
43 // from pp_errors.h. 44 // from pp_errors.h.
44 virtual int32_t SendMessage(PP_Var message) = 0; 45 virtual int32_t SendMessage(PP_Var message) = 0;
45 46
46 // Returns the bufferedAmount attribute of The WebSocket API. 47 // Returns the bufferedAmount attribute of The WebSocket API.
47 virtual uint64_t GetBufferedAmount() = 0; 48 virtual uint64_t GetBufferedAmount() = 0;
48 49
49 // Returns the CloseEvent code attribute of The WebSocket API. Returned code 50 // Returns the CloseEvent code attribute of The WebSocket API. Returned code
50 // is valid if the connection is already closed and wasClean attribute is 51 // is valid if the connection is already closed and wasClean attribute is
(...skipping 19 matching lines...) Expand all
70 virtual PP_WebSocketReadyState GetReadyState() = 0; 71 virtual PP_WebSocketReadyState GetReadyState() = 0;
71 72
72 // Returns the url attribute of The WebSocket API. 73 // Returns the url attribute of The WebSocket API.
73 virtual PP_Var GetURL() = 0; 74 virtual PP_Var GetURL() = 0;
74 }; 75 };
75 76
76 } // namespace thunk 77 } // namespace thunk
77 } // namespace ppapi 78 } // namespace ppapi
78 79
79 #endif // PPAPI_THUNK_WEBSOCKET_API_H_ 80 #endif // PPAPI_THUNK_WEBSOCKET_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698