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

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

Issue 6549037: Dup command-buffer SHM handle before auto-closing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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
« no previous file with comments | « base/sync_socket_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ppapi/proxy/ppb_context_3d_proxy.h" 5 #include "ppapi/proxy/ppb_context_3d_proxy.h"
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h" 9 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const PPB_Context3D_Dev context_3d_interface = { 126 const PPB_Context3D_Dev context_3d_interface = {
127 &Create, 127 &Create,
128 &IsContext3D, 128 &IsContext3D,
129 &GetAttrib, 129 &GetAttrib,
130 &BindSurfaces, 130 &BindSurfaces,
131 &GetBoundSurfaces, 131 &GetBoundSurfaces,
132 }; 132 };
133 133
134 base::SharedMemoryHandle SHMHandleFromInt(int shm_handle) { 134 base::SharedMemoryHandle SHMHandleFromInt(int shm_handle) {
135 #if defined(OS_POSIX) 135 #if defined(OS_POSIX)
136 return base::FileDescriptor(shm_handle, true); 136 // The handle isn't ours to close, but we want to keep a reference to the
137 // handle until it is actually sent, so duplicate it, and mark auto-close.
138 return base::FileDescriptor(dup(shm_handle), true);
137 #elif defined(OS_WIN) 139 #elif defined(OS_WIN)
140 // TODO(piman): DuplicateHandle to the plugin process.
138 return reinterpret_cast<HANDLE>(shm_handle); 141 return reinterpret_cast<HANDLE>(shm_handle);
139 #else 142 #else
140 #error "Platform not supported." 143 #error "Platform not supported."
141 #endif 144 #endif
142 } 145 }
143 146
144 gpu::CommandBuffer::State GPUStateFromPPState( 147 gpu::CommandBuffer::State GPUStateFromPPState(
145 const PP_Context3DTrustedState& s) { 148 const PP_Context3DTrustedState& s) {
146 gpu::CommandBuffer::State state; 149 gpu::CommandBuffer::State state;
147 state.num_entries = s.num_entries; 150 state.num_entries = s.num_entries;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 &shm_handle, 587 &shm_handle,
585 &shm_size)) { 588 &shm_size)) {
586 return; 589 return;
587 } 590 }
588 *transfer_buffer = SHMHandleFromInt(shm_handle); 591 *transfer_buffer = SHMHandleFromInt(shm_handle);
589 *size = shm_size; 592 *size = shm_size;
590 } 593 }
591 594
592 } // namespace proxy 595 } // namespace proxy
593 } // namespace pp 596 } // namespace pp
OLDNEW
« no previous file with comments | « base/sync_socket_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698