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

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

Issue 6528004: Fix PPB_Audio_Proxy handling of file descriptors. (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 | « no previous file | 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_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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698