OLD | NEW |
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 // SRPC-abstraction wrappers around PPB_WebSocket functions. | 5 // SRPC-abstraction wrappers around PPB_WebSocket functions. |
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/browser_callback.h" | 8 #include "native_client/src/shared/ppapi_proxy/browser_callback.h" |
9 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 9 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
10 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 10 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 char* url_bytes) { | 314 char* url_bytes) { |
315 NaClSrpcClosureRunner runner(done); | 315 NaClSrpcClosureRunner runner(done); |
316 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 316 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
317 | 317 |
318 PP_Var url = PPBWebSocketInterface()->GetURL(ws); | 318 PP_Var url = PPBWebSocketInterface()->GetURL(ws); |
319 DebugPrintf("PPB_WebSocket::GetURL:: url.type=%d\n", url.type); | 319 DebugPrintf("PPB_WebSocket::GetURL:: url.type=%d\n", url.type); |
320 | 320 |
321 if (SerializeTo(&url, url_bytes, url_size)) | 321 if (SerializeTo(&url, url_bytes, url_size)) |
322 rpc->result = NACL_SRPC_RESULT_OK; | 322 rpc->result = NACL_SRPC_RESULT_OK; |
323 } | 323 } |
324 | |
325 void PpbWebSocketRpcServer::PPB_WebSocket_SetBinaryType( | |
326 NaClSrpcRpc* rpc, | |
327 NaClSrpcClosure* done, | |
328 // inputs | |
329 PP_Resource ws, | |
330 int32_t binary_type, | |
331 // outputs | |
332 int32_t* success) { | |
333 NaClSrpcClosureRunner runner(done); | |
334 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | |
335 | |
336 PP_Bool pp_success = PPBWebSocketInterface()->SetBinaryType( | |
337 ws, static_cast<PP_WebSocketBinaryType_Dev>(binary_type)); | |
338 *success = PP_ToBool(pp_success); | |
339 DebugPrintf("PPB_WebSocket::SetBinaryType:: success=%d\n", *success); | |
340 | |
341 rpc->result = NACL_SRPC_RESULT_OK; | |
342 } | |
343 | |
344 void PpbWebSocketRpcServer::PPB_WebSocket_GetBinaryType( | |
345 NaClSrpcRpc* rpc, | |
346 NaClSrpcClosure* done, | |
347 // inputs | |
348 PP_Resource ws, | |
349 // outputs | |
350 int32_t* binary_type) { | |
351 NaClSrpcClosureRunner runner(done); | |
352 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | |
353 | |
354 *binary_type = static_cast<int32_t>( | |
355 PPBWebSocketInterface()->GetBinaryType(ws)); | |
356 DebugPrintf( | |
357 "PPB_WebSocket::GetBinaryType:: binary_type=%d\n", *binary_type); | |
358 | |
359 rpc->result = NACL_SRPC_RESULT_OK; | |
360 } | |
OLD | NEW |