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

Unified Diff: ppapi/proxy/ppb_audio_proxy.cc

Issue 10828023: PPAPI/NaCl: Make NaClIPCAdapter transfer handles more generally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review? Created 8 years, 4 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
Index: ppapi/proxy/ppb_audio_proxy.cc
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index f60ac812127e96804d053ddf7ac1e5d76cc8014b..6e61f75fa3e02ff99d749f8203ed3007ec04efab 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -252,9 +252,11 @@ void PPB_Audio_Proxy::AudioChannelConnected(
// inconvenient to clean up. Our IPC code will automatically handle this for
// us, as long as the remote side always closes the handles it receives
// (in OnMsgNotifyAudioStreamCreated), even in the failure case.
+ ppapi::proxy::SerializedHandle fd_wrapper(socket_handle);
+ ppapi::proxy::SerializedHandle handle_wrapper(
+ shared_memory, shared_memory_length + sizeof(int32_t));
dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated(
- API_ID_PPB_AUDIO, resource, result_code, socket_handle,
- shared_memory, shared_memory_length));
+ API_ID_PPB_AUDIO, resource, result_code, fd_wrapper, handle_wrapper));
}
int32_t PPB_Audio_Proxy::GetAudioConnectedHandles(
@@ -299,21 +301,23 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles(
void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated(
const HostResource& audio_id,
int32_t result_code,
- IPC::PlatformFileForTransit socket_handle,
- base::SharedMemoryHandle handle,
- uint32_t length) {
+ ppapi::proxy::SerializedHandle socket_handle,
+ ppapi::proxy::SerializedHandle handle) {
+ CHECK(socket_handle.is_socket());
+ CHECK(handle.is_shmem());
EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id);
if (enter.failed() || result_code != PP_OK) {
// The caller may still have given us these handles in the failure case.
// The easiest way to clean these up is to just put them in the objects
// and then close them. This failure case is not performance critical.
base::SyncSocket temp_socket(
- IPC::PlatformFileForTransitToPlatformFile(socket_handle));
- base::SharedMemory temp_mem(handle, false);
+ IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()));
+ base::SharedMemory temp_mem(handle.shmem(), false);
} else {
static_cast<Audio*>(enter.object())->SetStreamInfo(
- enter.resource()->pp_instance(), handle, length,
- IPC::PlatformFileForTransitToPlatformFile(socket_handle));
+ enter.resource()->pp_instance(), handle.shmem(),
+ handle.size() - sizeof(int32_t),
+ IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()));
}
}

Powered by Google App Engine
This is Rietveld 408576698