OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |