diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-19 01:39:05 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-19 01:39:05 +0000 |
commit | 771fc8dd423146436f1c431ef0bfdde382854a0f (patch) | |
tree | cd2915c32ec4ae45a4175e628abf79e0861fcaae | |
parent | c5fb6520d76ffd57cf453b0b9e54c1bcd8aed922 (diff) | |
download | chromium_src-771fc8dd423146436f1c431ef0bfdde382854a0f.zip chromium_src-771fc8dd423146436f1c431ef0bfdde382854a0f.tar.gz chromium_src-771fc8dd423146436f1c431ef0bfdde382854a0f.tar.bz2 |
Get PPB_Audio interface building as untrusted code.
Add audio source files needed for PPB_Audio to build, and #ifdef out
host side code. Flesh out the SyncSocket and CancelableSyncSocket stubs
a bit more to compile and link.
BUG=116317
TEST=compiles
Review URL: https://chromiumcodereview.appspot.com/10412014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138007 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/sync_socket_nacl.cc | 4 | ||||
-rw-r--r-- | ppapi/ppapi_proxy_untrusted.gypi | 11 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.cc | 49 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/resource_creation_api.h | 4 |
6 files changed, 42 insertions, 32 deletions
diff --git a/base/sync_socket_nacl.cc b/base/sync_socket_nacl.cc index 9e0c0f9..1aa606c 100644 --- a/base/sync_socket_nacl.cc +++ b/base/sync_socket_nacl.cc @@ -50,6 +50,10 @@ CancelableSyncSocket::CancelableSyncSocket(Handle handle) : SyncSocket(handle) { } +size_t CancelableSyncSocket::Send(const void* buffer, size_t length) { + return 0; +} + bool CancelableSyncSocket::Shutdown() { return false; } diff --git a/ppapi/ppapi_proxy_untrusted.gypi b/ppapi/ppapi_proxy_untrusted.gypi index 9497060..fa1e3a0 100644 --- a/ppapi/ppapi_proxy_untrusted.gypi +++ b/ppapi/ppapi_proxy_untrusted.gypi @@ -108,6 +108,7 @@ # '../base/sys_info_posix.cc', '../base/sys_string_conversions_posix.cc', '../base/task_runner.cc', + '../base/thread_task_runner_handle.cc', '../base/threading/non_thread_safe_impl.cc', '../base/threading/platform_thread_posix.cc', '../base/threading/post_task_and_reply_impl.cc', @@ -247,9 +248,9 @@ 'shared_impl/platform_file.cc', 'shared_impl/ppapi_globals.cc', 'shared_impl/ppapi_preferences.cc', -# 'shared_impl/ppb_audio_config_shared.cc', + 'shared_impl/ppb_audio_config_shared.cc', # 'shared_impl/ppb_audio_input_shared.cc', -# 'shared_impl/ppb_audio_shared.cc', + 'shared_impl/ppb_audio_shared.cc', 'shared_impl/ppb_crypto_shared.cc', 'shared_impl/ppb_device_ref_shared.cc', 'shared_impl/ppb_file_io_shared.cc', @@ -278,10 +279,10 @@ 'shared_impl/var_tracker.cc', 'thunk/enter.cc', -# 'thunk/ppb_audio_config_thunk.cc', + 'thunk/ppb_audio_config_thunk.cc', # 'thunk/ppb_audio_input_thunk.cc', # 'thunk/ppb_audio_input_trusted_thunk.cc', -# 'thunk/ppb_audio_thunk.cc', + 'thunk/ppb_audio_thunk.cc', # 'thunk/ppb_audio_trusted_thunk.cc', # 'thunk/ppb_broker_thunk.cc', # 'thunk/ppb_browser_font_trusted_thunk.cc', @@ -353,7 +354,7 @@ 'proxy/ppapi_messages.cc', 'proxy/ppapi_param_traits.cc', # 'proxy/ppb_audio_input_proxy.cc', -# 'proxy/ppb_audio_proxy.cc', + 'proxy/ppb_audio_proxy.cc', # 'proxy/ppb_broker_proxy.cc', # 'proxy/ppb_buffer_proxy.cc', 'proxy/ppb_core_proxy.cc', diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index 1000391..380bc39 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -157,9 +157,12 @@ PP_Resource PPB_Audio_Proxy::CreateProxyResource( bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Audio_Proxy, msg) +// Don't build host side into NaCl IRT. +#if !defined(OS_NACL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_Create, OnMsgCreate) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, OnMsgStartOrStop) +#endif IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, OnMsgNotifyAudioStreamCreated) IPC_MESSAGE_UNHANDLED(handled = false) @@ -167,6 +170,7 @@ bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { return handled; } +#if !defined(OS_NACL) void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, int32_t sample_rate, uint32_t sample_frame_count, @@ -228,28 +232,6 @@ void PPB_Audio_Proxy::OnMsgStartOrStop(const HostResource& audio_id, enter.object()->StopPlayback(); } -// Processed in the plugin (message from host). -void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( - const HostResource& audio_id, - int32_t result_code, - IPC::PlatformFileForTransit socket_handle, - base::SharedMemoryHandle handle, - uint32_t length) { - 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); - } else { - static_cast<Audio*>(enter.object())->SetStreamInfo( - enter.resource()->pp_instance(), handle, length, - IPC::PlatformFileForTransitToPlatformFile(socket_handle)); - } -} - void PPB_Audio_Proxy::AudioChannelConnected( int32_t result, const HostResource& resource) { @@ -312,6 +294,29 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles( return PP_OK; } +#endif // !defined(OS_NACL) + +// Processed in the plugin (message from host). +void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( + const HostResource& audio_id, + int32_t result_code, + IPC::PlatformFileForTransit socket_handle, + base::SharedMemoryHandle handle, + uint32_t length) { + 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); + } else { + static_cast<Audio*>(enter.object())->SetStreamInfo( + enter.resource()->pp_instance(), handle, length, + IPC::PlatformFileForTransitToPlatformFile(socket_handle)); + } +} } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index de53735..7a4cc01 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -172,7 +172,6 @@ PP_Resource ResourceCreationProxy::CreateWheelInputEvent( instance, data))->GetReference(); } -#if !defined(OS_NACL) PP_Resource ResourceCreationProxy::CreateAudio( PP_Instance instance, PP_Resource config_id, @@ -190,8 +189,9 @@ PP_Resource ResourceCreationProxy::CreateAudioConfig( OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count); } +#if !defined(OS_NACL) PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { - // Proxied plugins can't created trusted audio devices. + // Proxied plugins can't create trusted audio devices. return 0; } diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index e4fdb52..2db304d 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -72,7 +72,6 @@ class ResourceCreationProxy : public InterfaceProxy, const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) OVERRIDE; -#if !defined(OS_NACL) virtual PP_Resource CreateAudio(PP_Instance instance, PP_Resource config_id, PPB_Audio_Callback audio_callback, @@ -80,6 +79,7 @@ class ResourceCreationProxy : public InterfaceProxy, virtual PP_Resource CreateAudioConfig(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) OVERRIDE; +#if !defined(OS_NACL) virtual PP_Resource CreateAudioTrusted(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateAudioInput0_1( PP_Instance instance, diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 42ab267..ee7c5c2 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -78,15 +78,15 @@ class ResourceCreationAPI { const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) = 0; -#if !defined(OS_NACL) virtual PP_Resource CreateAudio(PP_Instance instance, PP_Resource config_id, PPB_Audio_Callback audio_callback, void* user_data) = 0; - virtual PP_Resource CreateAudioTrusted(PP_Instance instance) = 0; virtual PP_Resource CreateAudioConfig(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) = 0; +#if !defined(OS_NACL) + virtual PP_Resource CreateAudioTrusted(PP_Instance instance) = 0; virtual PP_Resource CreateAudioInput0_1( PP_Instance instance, PP_Resource config_id, |