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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc

Issue 9677061: Pass dup'd handles to nacl::DescWrapper instead of bumping the ref count. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc (revision 126418)
+++ ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc (working copy)
@@ -6,6 +6,7 @@
#include "native_client/src/include/nacl_scoped_ptr.h"
#include "native_client/src/include/portability.h"
+#include "native_client/src/shared/imc/nacl_imc.h"
#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
@@ -67,27 +68,42 @@
if (NULL == audioTrusted) {
return;
}
- int sync_socket_handle;
- int shared_memory_handle;
- uint32_t shared_memory_size;
+ const int kInvalidIntHandle = int(nacl::kInvalidHandle);
+ int sync_socket_handle = kInvalidIntHandle;
+ int shared_memory_handle = kInvalidIntHandle;
+ uint32_t shared_memory_size = 0;
if (PP_OK != audioTrusted->GetSyncSocket(data->audio_id,
&sync_socket_handle)) {
return;
}
+ if (kInvalidIntHandle == sync_socket_handle) {
+ return;
+ }
if (PP_OK != audioTrusted->GetSharedMemory(data->audio_id,
&shared_memory_handle,
&shared_memory_size)) {
return;
}
+ if (kInvalidIntHandle == shared_memory_handle) {
+ return;
+ }
nacl::DescWrapperFactory factory;
- NaClHandle nacl_shm_handle = (NaClHandle)shared_memory_handle;
- NaClHandle nacl_sync_handle = (NaClHandle)sync_socket_handle;
+ NaClHandle nacl_shm_handle = NaClHandle(shared_memory_handle);
+ NaClHandle nacl_sync_handle = NaClHandle(sync_socket_handle);
+ NaClHandle nacl_shm_dup_handle = NaClDuplicateNaClHandle(nacl_shm_handle);
+ if (nacl::kInvalidHandle == nacl_shm_dup_handle) {
+ return;
+ }
nacl::scoped_ptr<nacl::DescWrapper> shm_wrapper(factory.ImportShmHandle(
- nacl_shm_handle, shared_memory_size));
+ nacl_shm_dup_handle, shared_memory_size));
+ NaClHandle nacl_sync_dup_handle = NaClDuplicateNaClHandle(nacl_sync_handle);
+ if (nacl::kInvalidHandle == nacl_sync_dup_handle) {
+ return;
+ }
nacl::scoped_ptr<nacl::DescWrapper> socket_wrapper(
- factory.ImportSyncSocketHandle(nacl_sync_handle));
- NaClDesc *nacl_shm = NaClDescRef(shm_wrapper->desc());
- NaClDesc *nacl_socket = NaClDescRef(socket_wrapper->desc());
+ factory.ImportSyncSocketHandle(nacl_sync_dup_handle));
+ NaClDesc *nacl_shm = shm_wrapper->desc();
+ NaClDesc *nacl_socket = socket_wrapper->desc();
static_cast<void>(PppAudioRpcClient::PPP_Audio_StreamCreated(
ppapi_proxy::GetMainSrpcChannel(data->instance_id),
data->audio_id,
« no previous file with comments | « no previous file | ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698