diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-23 14:27:42 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-23 14:27:42 +0000 |
commit | aed965375dec978e7feb8722b1b94250a2a6e039 (patch) | |
tree | 9f8ccdf7a3902fa1db54e0c036f7cb9ca96775fb /ppapi/thunk/ppb_websocket_api.h | |
parent | 94bd0a2e94c1f07ccc0236a95e57a2e16b94038a (diff) | |
download | chromium_src-aed965375dec978e7feb8722b1b94250a2a6e039.zip chromium_src-aed965375dec978e7feb8722b1b94250a2a6e039.tar.gz chromium_src-aed965375dec978e7feb8722b1b94250a2a6e039.tar.bz2 |
PPAPI: Make blocking completion callbacks work.
This also makes scoped_refptr<TrackedCallback> the "new" way to pass completion callbacks in an API. This allows the Enter object to handle checking for blocking callbacks on the main thread to report error, and blocking if on the background thread. This way, interfaces don't have to write any special cases for blocking callbacks.
When built with enable_pepper_threading=1 locally, URLLoader tests all pass for blocking completion callbacks. I haven't updated all tests yet.
BUG=92909
TEST=
Review URL: https://chromiumcodereview.appspot.com/10081020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_websocket_api.h')
-rw-r--r-- | ppapi/thunk/ppb_websocket_api.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ppapi/thunk/ppb_websocket_api.h b/ppapi/thunk/ppb_websocket_api.h index 04fc960..e5b7791 100644 --- a/ppapi/thunk/ppb_websocket_api.h +++ b/ppapi/thunk/ppb_websocket_api.h @@ -5,10 +5,14 @@ #ifndef PPAPI_THUNK_WEBSOCKET_API_H_ #define PPAPI_THUNK_WEBSOCKET_API_H_ +#include "base/memory/ref_counted.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/ppb_websocket.h" namespace ppapi { + +class TrackedCallback; + namespace thunk { // Some arguments and attributes are based on The WebSocket Protocol and The @@ -25,19 +29,19 @@ class PPB_WebSocket_API { virtual int32_t Connect(PP_Var url, const PP_Var protocols[], uint32_t protocol_count, - PP_CompletionCallback callback) = 0; + scoped_refptr<TrackedCallback> callback) = 0; // Closes the established connection with specified |code| and |reason|. // Returns an int32_t error code from pp_errors.h. virtual int32_t Close(uint16_t code, PP_Var reason, - PP_CompletionCallback callback) = 0; + scoped_refptr<TrackedCallback> callback) = 0; // Receives a message from the WebSocket server. Caller must keep specified // |message| object as valid until completion callback is invoked. Returns an // int32_t error code from pp_errors.h. virtual int32_t ReceiveMessage(PP_Var* message, - PP_CompletionCallback callback) = 0; + scoped_refptr<TrackedCallback> callback) = 0; // Sends a message to the WebSocket server. Returns an int32_t error code // from pp_errors.h. |