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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc

Issue 9724007: WebSocket Pepper API: fix data corruption at ReceiveMessage in NaCl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 years, 9 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
« no previous file with comments | « chrome/test/ui/ppapi_uitest.cc ('k') | ppapi/tests/test_websocket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc
index 65c08775d4ea4bc8662374a7bfda9395baf46f1f..7d19e1ae4b9802cda5203574bcac0bd19c1baf9c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc
@@ -144,6 +144,11 @@ void PpbWebSocketRpcServer::PPB_WebSocket_ReceiveMessage(
MakeRemoteCompletionCallback(rpc->channel, callback_id, &callback_var);
if (NULL == remote_callback.func)
return;
+ // TODO(toyoshim): Removing optional flag is easy way to expect asynchronous
+ // completion on the following PPBWebSocketInterface()->ReceiveMessage(). But
+ // from the viewpoint of performance, we should handle synchronous
+ // completion correctly.
+ remote_callback.flags &= ~PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
// The callback is always invoked asynchronously for now, so it doesn't care
// about re-entrancy.
@@ -151,7 +156,7 @@ void PpbWebSocketRpcServer::PPB_WebSocket_ReceiveMessage(
ws, callback_var, remote_callback);
DebugPrintf("PPB_WebSocket::ReceiveMessage: pp_error=%"NACL_PRId32"\n",
*pp_error);
-
+ CHECK(*pp_error != PP_OK); // Should not complete synchronously
if (*pp_error != PP_OK_COMPLETIONPENDING)
DeleteRemoteCallbackInfo(remote_callback);
rpc->result = NACL_SRPC_RESULT_OK;
« no previous file with comments | « chrome/test/ui/ppapi_uitest.cc ('k') | ppapi/tests/test_websocket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698