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_audio_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_proxy.h" |
6 | 6 |
7 #include "base/threading/simple_thread.h" | 7 #include "base/threading/simple_thread.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/ppb_audio.h" | 9 #include "ppapi/c/ppb_audio.h" |
10 #include "ppapi/c/trusted/ppb_audio_trusted.h" | 10 #include "ppapi/c/trusted/ppb_audio_trusted.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // On Windows, duplicate the socket into the plugin process, this will | 275 // On Windows, duplicate the socket into the plugin process, this will |
276 // automatically close the source handle. | 276 // automatically close the source handle. |
277 ::DuplicateHandle( | 277 ::DuplicateHandle( |
278 GetCurrentProcess(), | 278 GetCurrentProcess(), |
279 reinterpret_cast<HANDLE>(static_cast<intptr_t>(socket_handle)), | 279 reinterpret_cast<HANDLE>(static_cast<intptr_t>(socket_handle)), |
280 dispatcher()->remote_process_handle(), foreign_socket_handle, | 280 dispatcher()->remote_process_handle(), foreign_socket_handle, |
281 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, | 281 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, |
282 FALSE, DUPLICATE_CLOSE_SOURCE); | 282 FALSE, DUPLICATE_CLOSE_SOURCE); |
283 #else | 283 #else |
284 // On Posix, the socket handle will be auto-duplicated when we send the | 284 // On Posix, the socket handle will be auto-duplicated when we send the |
285 // FileDescriptor. Set AutoClose since we don't need the handle any more. | 285 // FileDescriptor. Don't set AutoClose since this is not our handle. |
286 *foreign_socket_handle = base::FileDescriptor(socket_handle, true); | 286 *foreign_socket_handle = base::FileDescriptor(socket_handle, false); |
287 #endif | 287 #endif |
288 | 288 |
289 // Get the shared memory for the buffer. | 289 // Get the shared memory for the buffer. |
290 // TODO(brettw) remove the reinterpret cast when the interface is updated. | 290 // TODO(brettw) remove the reinterpret cast when the interface is updated. |
291 int shared_memory_handle; | 291 int shared_memory_handle; |
292 result = audio_trusted->GetSharedMemory(resource.host_resource(), | 292 result = audio_trusted->GetSharedMemory(resource.host_resource(), |
293 &shared_memory_handle, | 293 &shared_memory_handle, |
294 shared_memory_length); | 294 shared_memory_length); |
295 if (result != PP_OK) | 295 if (result != PP_OK) |
296 return result; | 296 return result; |
(...skipping 10 matching lines...) Expand all Loading... |
307 // close the source handle. | 307 // close the source handle. |
308 if (!shared_memory.GiveToProcess(dispatcher()->remote_process_handle(), | 308 if (!shared_memory.GiveToProcess(dispatcher()->remote_process_handle(), |
309 foreign_shared_memory_handle)) | 309 foreign_shared_memory_handle)) |
310 return PP_ERROR_FAILED; | 310 return PP_ERROR_FAILED; |
311 | 311 |
312 return PP_OK; | 312 return PP_OK; |
313 } | 313 } |
314 | 314 |
315 } // namespace proxy | 315 } // namespace proxy |
316 } // namespace pp | 316 } // namespace pp |
OLD | NEW |