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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.cc

Issue 10332138: WebSocket Pepper API: allow to close connection without code and reason (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uint16_t -> enum Created 8 years, 7 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 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h" 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h"
6 6
7 #include "native_client/src/include/nacl_scoped_ptr.h" 7 #include "native_client/src/include/nacl_scoped_ptr.h"
8 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" 8 #include "native_client/src/shared/ppapi_proxy/object_serialize.h"
9 #include "native_client/src/shared/ppapi_proxy/plugin_callback.h" 9 #include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
10 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" 10 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 &pp_error); 80 &pp_error);
81 DebugPrintf("PPB_WebSocket::Connect: %s\n", 81 DebugPrintf("PPB_WebSocket::Connect: %s\n",
82 NaClSrpcErrorString(srpc_result)); 82 NaClSrpcErrorString(srpc_result));
83 83
84 if (srpc_result != NACL_SRPC_RESULT_OK) 84 if (srpc_result != NACL_SRPC_RESULT_OK)
85 pp_error = PP_ERROR_FAILED; 85 pp_error = PP_ERROR_FAILED;
86 return MayForceCallback(callback, pp_error); 86 return MayForceCallback(callback, pp_error);
87 } 87 }
88 88
89 int32_t Close(PP_Resource ws, 89 int32_t Close(PP_Resource ws,
90 uint16_t code, 90 PP_WebSocketStatusCode code,
91 PP_Var reason, 91 PP_Var reason,
92 PP_CompletionCallback callback) { 92 PP_CompletionCallback callback) {
93 DebugPrintf("PPB_WebSocket::Close: ws=%"NACL_PRId32"\n", ws); 93 DebugPrintf("PPB_WebSocket::Close: ws=%"NACL_PRId32"\n", ws);
94 94
95 nacl_abi_size_t reason_size = 0; 95 nacl_abi_size_t reason_size = 0;
96 nacl::scoped_array<char> reason_bytes(Serialize(&reason, 1, &reason_size)); 96 nacl::scoped_array<char> reason_bytes(Serialize(&reason, 1, &reason_size));
97 97
98 int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback); 98 int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
99 if (callback_id == 0) 99 if (callback_id == 0)
100 return PP_ERROR_BLOCKS_MAIN_THREAD; 100 return PP_ERROR_BLOCKS_MAIN_THREAD;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 &GetCloseWasClean, 344 &GetCloseWasClean,
345 &GetExtensions, 345 &GetExtensions,
346 &GetProtocol, 346 &GetProtocol,
347 &GetReadyState, 347 &GetReadyState,
348 &GetURL 348 &GetURL
349 }; 349 };
350 return &websocket_interface; 350 return &websocket_interface;
351 } 351 }
352 352
353 } // namespace ppapi_proxy 353 } // namespace ppapi_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698