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

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

Issue 8919014: Revert "Revert 113479 - Revert "Revert 113250 - Add CommandBuffer::SetGetBuffer"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_Graphics3D functions. 5 // SRPC-abstraction wrappers around PPB_Graphics3D functions.
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "native_client/src/include/nacl_scoped_ptr.h" 9 #include "native_client/src/include/nacl_scoped_ptr.h"
10 #include "native_client/src/include/portability.h" 10 #include "native_client/src/include/portability.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 DebugPrintf(" PPB_Graphics3DTrusted_CreateRaw: resource=%"NACL_PRId32"\n", 238 DebugPrintf(" PPB_Graphics3DTrusted_CreateRaw: resource=%"NACL_PRId32"\n",
239 *resource_id); 239 *resource_id);
240 rpc->result = NACL_SRPC_RESULT_OK; 240 rpc->result = NACL_SRPC_RESULT_OK;
241 } 241 }
242 242
243 void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_InitCommandBuffer( 243 void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_InitCommandBuffer(
244 NaClSrpcRpc* rpc, 244 NaClSrpcRpc* rpc,
245 NaClSrpcClosure* done, 245 NaClSrpcClosure* done,
246 PP_Resource resource_id, 246 PP_Resource resource_id,
247 int32_t size,
248 int32_t* success) { 247 int32_t* success) {
249 DebugPrintf("PPB_Graphics3DTrusted_InitCommandBuffer(...) resource_id: %d\n", 248 DebugPrintf("PPB_Graphics3DTrusted_InitCommandBuffer(...) resource_id: %d\n",
250 resource_id); 249 resource_id);
251 NaClSrpcClosureRunner runner(done); 250 NaClSrpcClosureRunner runner(done);
252 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 251 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
253 if ((size > kMaxAllowedBufferSize) || (size < 0))
254 return;
255 *success = ppapi_proxy::PPBGraphics3DTrustedInterface()->InitCommandBuffer( 252 *success = ppapi_proxy::PPBGraphics3DTrustedInterface()->InitCommandBuffer(
256 resource_id, size); 253 resource_id);
257 rpc->result = NACL_SRPC_RESULT_OK; 254 rpc->result = NACL_SRPC_RESULT_OK;
258 } 255 }
259 256
260 257 void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_SetGetBuffer(
261 void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetRingBuffer(
262 NaClSrpcRpc* rpc, 258 NaClSrpcRpc* rpc,
263 NaClSrpcClosure* done, 259 NaClSrpcClosure* done,
264 PP_Resource resource_id, 260 PP_Resource resource_id,
265 NaClSrpcImcDescType* shm_desc, 261 int32_t transfer_buffer_id) {
266 int32_t* shm_size) { 262 DebugPrintf("PPB_Graphics3DTrusted_SetGetBuffer\n");
267 DebugPrintf("PPB_Graphics3DTrusted_GetRingBuffer\n");
268 nacl::DescWrapperFactory factory;
269 nacl::scoped_ptr<nacl::DescWrapper> desc_wrapper;
270 NaClSrpcClosureRunner runner(done); 263 NaClSrpcClosureRunner runner(done);
271 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 264 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
272 265 ppapi_proxy::PPBGraphics3DTrustedInterface()->SetGetBuffer(
273 int native_handle = 0; 266 resource_id, transfer_buffer_id);
274 uint32_t native_size = 0;
275 ppapi_proxy::PPBGraphics3DTrustedInterface()->GetRingBuffer(
276 resource_id, &native_handle, &native_size);
277 desc_wrapper.reset(factory.ImportShmHandle(
278 (NaClHandle)native_handle, native_size));
279 *shm_desc = desc_wrapper->desc();
280 *shm_size = native_size;
281 rpc->result = NACL_SRPC_RESULT_OK; 267 rpc->result = NACL_SRPC_RESULT_OK;
282 } 268 }
283 269
284 void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetState( 270 void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetState(
285 NaClSrpcRpc* rpc, 271 NaClSrpcRpc* rpc,
286 NaClSrpcClosure* done, 272 NaClSrpcClosure* done,
287 PP_Resource resource_id, 273 PP_Resource resource_id,
288 nacl_abi_size_t* state_size, char* state) { 274 nacl_abi_size_t* state_size, char* state) {
289 DebugPrintf("PPB_Graphics3DTrusted_GetState\n"); 275 DebugPrintf("PPB_Graphics3DTrusted_GetState\n");
290 NaClSrpcClosureRunner runner(done); 276 NaClSrpcClosureRunner runner(done);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 GetTransferBuffer(resource_id, id, &native_handle, &native_size); 387 GetTransferBuffer(resource_id, id, &native_handle, &native_size);
402 desc_wrapper.reset(factory.ImportShmHandle( 388 desc_wrapper.reset(factory.ImportShmHandle(
403 (NaClHandle)native_handle, native_size)); 389 (NaClHandle)native_handle, native_size));
404 *shm_desc = desc_wrapper->desc(); 390 *shm_desc = desc_wrapper->desc();
405 *shm_size = native_size; 391 *shm_size = native_size;
406 rpc->result = NACL_SRPC_RESULT_OK; 392 rpc->result = NACL_SRPC_RESULT_OK;
407 393
408 } 394 }
409 395
410 //@} 396 //@}
OLDNEW
« no previous file with comments | « ppapi/c/trusted/ppb_graphics_3d_trusted.h ('k') | ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698