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

Side by Side Diff: ppapi/proxy/ppb_graphics_3d_proxy.cc

Issue 1154613006: Update pepper to not assume that SharedMemoryHandle is an int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another nits pass. Created 5 years, 6 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
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 "ppapi/proxy/ppb_graphics_3d_proxy.h" 5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "gpu/command_buffer/client/gles2_implementation.h" 8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "gpu/command_buffer/common/command_buffer.h" 9 #include "gpu/command_buffer/common/command_buffer.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 15 matching lines...) Expand all
26 26
27 namespace { 27 namespace {
28 28
29 const int32 kCommandBufferSize = 1024 * 1024; 29 const int32 kCommandBufferSize = 1024 * 1024;
30 const int32 kTransferBufferSize = 1024 * 1024; 30 const int32 kTransferBufferSize = 1024 * 1024;
31 31
32 #if !defined(OS_NACL) 32 #if !defined(OS_NACL)
33 base::SharedMemoryHandle TransportSHMHandle( 33 base::SharedMemoryHandle TransportSHMHandle(
34 Dispatcher* dispatcher, 34 Dispatcher* dispatcher,
35 const base::SharedMemoryHandle& handle) { 35 const base::SharedMemoryHandle& handle) {
36 base::PlatformFile source = IPC::PlatformFileForTransitToPlatformFile(handle);
37 // Don't close the handle, it doesn't belong to us. 36 // Don't close the handle, it doesn't belong to us.
38 return dispatcher->ShareHandleWithRemote(source, false); 37 return dispatcher->ShareSharedMemoryHandleWithRemote(handle);
39 } 38 }
40 #endif // !defined(OS_NACL) 39 #endif // !defined(OS_NACL)
41 40
42 gpu::CommandBuffer::State GetErrorState() { 41 gpu::CommandBuffer::State GetErrorState() {
43 gpu::CommandBuffer::State error_state; 42 gpu::CommandBuffer::State error_state;
44 error_state.error = gpu::error::kGenericError; 43 error_state.error = gpu::error::kGenericError;
45 return error_state; 44 return error_state;
46 } 45 }
47 46
48 } // namespace 47 } // namespace
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (attribs.empty() || 232 if (attribs.empty() ||
234 attribs.back() != PP_GRAPHICS3DATTRIB_NONE || 233 attribs.back() != PP_GRAPHICS3DATTRIB_NONE ||
235 !(attribs.size() & 1)) 234 !(attribs.size() & 1))
236 return; // Bad message. 235 return; // Bad message.
237 236
238 thunk::EnterResourceCreation enter(instance); 237 thunk::EnterResourceCreation enter(instance);
239 238
240 if (!enter.succeeded()) 239 if (!enter.succeeded())
241 return; 240 return;
242 241
243 base::SharedMemoryHandle handle = IPC::InvalidPlatformFileForTransit(); 242 base::SharedMemoryHandle handle = base::SharedMemory::NULLHandle();
244 result->SetHostResource( 243 result->SetHostResource(
245 instance, 244 instance,
246 enter.functions()->CreateGraphics3DRaw(instance, 245 enter.functions()->CreateGraphics3DRaw(instance,
247 share_context.host_resource(), 246 share_context.host_resource(),
248 &attribs.front(), 247 &attribs.front(),
249 capabilities, 248 capabilities,
250 &handle)); 249 &handle));
251 if (!result->is_null()) { 250 if (!result->is_null()) {
252 shared_state->set_shmem(TransportSHMHandle(dispatcher(), handle), 251 shared_state->set_shmem(TransportSHMHandle(dispatcher(), handle),
253 sizeof(gpu::CommandBuffer::State)); 252 sizeof(gpu::CommandBuffer::State));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( 373 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
375 int32_t result, 374 int32_t result,
376 const HostResource& context) { 375 const HostResource& context) {
377 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( 376 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
378 API_ID_PPB_GRAPHICS_3D, context, result)); 377 API_ID_PPB_GRAPHICS_3D, context, result));
379 } 378 }
380 #endif // !defined(OS_NACL) 379 #endif // !defined(OS_NACL)
381 380
382 } // namespace proxy 381 } // namespace proxy
383 } // namespace ppapi 382 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698