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

Unified Diff: ppapi/proxy/ppb_audio_input_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_input_proxy.cc
diff --git a/ppapi/proxy/ppb_audio_input_proxy.cc b/ppapi/proxy/ppb_audio_input_proxy.cc
index 011e332afcdbbbee92907a4eebd770134f245806..242c5ec29a401a83282c0c462ee2fb8c50f91a01 100644
--- a/ppapi/proxy/ppb_audio_input_proxy.cc
+++ b/ppapi/proxy/ppb_audio_input_proxy.cc
@@ -286,21 +286,23 @@ void PPB_AudioInput_Proxy::OnMsgEnumerateDevicesACK(
void PPB_AudioInput_Proxy::OnMsgOpenACK(
const HostResource& audio_input,
int32_t result,
- IPC::PlatformFileForTransit socket_handle,
- base::SharedMemoryHandle handle,
- uint32_t length) {
+ const ppapi::proxy::SerializedHandle& socket_handle,
+ const ppapi::proxy::SerializedHandle& handle) {
+ CHECK(socket_handle.is_socket());
+ CHECK(handle.is_shmem());
EnterPluginFromHostResource<PPB_AudioInput_API> enter(audio_input);
if (enter.failed()) {
// 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<AudioInput*>(enter.object())->OnOpenComplete(
- result, handle, length,
- IPC::PlatformFileForTransitToPlatformFile(socket_handle));
+ result, handle.shmem(), handle.size(),
+ IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()));
}
}
@@ -316,15 +318,21 @@ void PPB_AudioInput_Proxy::EnumerateDevicesACKInHost(
void PPB_AudioInput_Proxy::OpenACKInHost(int32_t result,
const HostResource& audio_input) {
- IPC::PlatformFileForTransit socket_handle =
- IPC::InvalidPlatformFileForTransit();
- base::SharedMemoryHandle shared_memory = IPC::InvalidPlatformFileForTransit();
- uint32_t shared_memory_length = 0;
+ ppapi::proxy::SerializedHandle socket_handle(
+ ppapi::proxy::SerializedHandle::SOCKET);
+ ppapi::proxy::SerializedHandle shared_memory(
+ ppapi::proxy::SerializedHandle::SHARED_MEMORY);
if (result == PP_OK) {
- result = GetAudioInputConnectedHandles(audio_input, &socket_handle,
- &shared_memory,
- &shared_memory_length);
+ IPC::PlatformFileForTransit temp_socket;
+ base::SharedMemoryHandle temp_shmem;
+ uint32_t temp_size;
+ result = GetAudioInputConnectedHandles(audio_input, &temp_socket,
+ &temp_shmem, &temp_size);
+ if (result == PP_OK) {
+ socket_handle.set_socket(temp_socket);
+ shared_memory.set_shmem(temp_shmem, temp_size);
+ }
}
// Send all the values, even on error. This simplifies some of our cleanup
@@ -334,7 +342,7 @@ void PPB_AudioInput_Proxy::OpenACKInHost(int32_t result,
// (in OnMsgOpenACK), even in the failure case.
dispatcher()->Send(new PpapiMsg_PPBAudioInput_OpenACK(
API_ID_PPB_AUDIO_INPUT_DEV, audio_input, result, socket_handle,
- shared_memory, shared_memory_length));
+ shared_memory));
}
int32_t PPB_AudioInput_Proxy::GetAudioInputConnectedHandles(

Powered by Google App Engine
This is Rietveld 408576698