Chromium Code Reviews| 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), |
|
brettw
2012/08/22 23:27:06
Can you add a comment why you do "- sizeof(int32_t
dmichael (off chromium)
2012/08/23 22:55:14
Oops, I meant to clean that up, thanks for pointin
|
| + IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor())); |
| } |
| } |