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

Unified Diff: ppapi/thunk/ppb_websocket_thunk.cc

Issue 8772001: WebSocket Pepper API: error handling improvement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to remote/master Created 9 years 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
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | webkit/plugins/ppapi/ppb_websocket_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_websocket_thunk.cc
diff --git a/ppapi/thunk/ppb_websocket_thunk.cc b/ppapi/thunk/ppb_websocket_thunk.cc
index d1de12718b9dd6c33ec79e9f9d2eab91d76a51d9..87cb8c7adbec03ec36a55ac581d27388b6edfe06 100644
--- a/ppapi/thunk/ppb_websocket_thunk.cc
+++ b/ppapi/thunk/ppb_websocket_thunk.cc
@@ -4,6 +4,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/thunk/common.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_websocket_api.h"
@@ -33,8 +34,10 @@ int32_t Connect(PP_Resource resource,
PP_CompletionCallback callback) {
EnterResource<PPB_WebSocket_API> enter(resource, false);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->Connect(url, protocols, protocol_count, callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result =
+ enter.object()->Connect(url, protocols, protocol_count, callback);
+ return MayForceCallback(callback, result);
}
int32_t Close(PP_Resource resource,
@@ -43,8 +46,9 @@ int32_t Close(PP_Resource resource,
PP_CompletionCallback callback) {
EnterResource<PPB_WebSocket_API> enter(resource, false);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->Close(code, reason, callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result = enter.object()->Close(code, reason, callback);
+ return MayForceCallback(callback, result);
}
int32_t ReceiveMessage(PP_Resource resource,
@@ -52,8 +56,9 @@ int32_t ReceiveMessage(PP_Resource resource,
PP_CompletionCallback callback) {
EnterResource<PPB_WebSocket_API> enter(resource, false);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->ReceiveMessage(message, callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result = enter.object()->ReceiveMessage(message, callback);
+ return MayForceCallback(callback, result);
}
int32_t SendMessage(PP_Resource resource, PP_Var message) {
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | webkit/plugins/ppapi/ppb_websocket_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698