Commit 771fc8dd authored by bbudge@chromium.org's avatar bbudge@chromium.org

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
parent c5fb6520
...@@ -50,6 +50,10 @@ CancelableSyncSocket::CancelableSyncSocket(Handle handle) ...@@ -50,6 +50,10 @@ CancelableSyncSocket::CancelableSyncSocket(Handle handle)
: SyncSocket(handle) { : SyncSocket(handle) {
} }
size_t CancelableSyncSocket::Send(const void* buffer, size_t length) {
return 0;
}
bool CancelableSyncSocket::Shutdown() { bool CancelableSyncSocket::Shutdown() {
return false; return false;
} }
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
# '../base/sys_info_posix.cc', # '../base/sys_info_posix.cc',
'../base/sys_string_conversions_posix.cc', '../base/sys_string_conversions_posix.cc',
'../base/task_runner.cc', '../base/task_runner.cc',
'../base/thread_task_runner_handle.cc',
'../base/threading/non_thread_safe_impl.cc', '../base/threading/non_thread_safe_impl.cc',
'../base/threading/platform_thread_posix.cc', '../base/threading/platform_thread_posix.cc',
'../base/threading/post_task_and_reply_impl.cc', '../base/threading/post_task_and_reply_impl.cc',
...@@ -247,9 +248,9 @@ ...@@ -247,9 +248,9 @@
'shared_impl/platform_file.cc', 'shared_impl/platform_file.cc',
'shared_impl/ppapi_globals.cc', 'shared_impl/ppapi_globals.cc',
'shared_impl/ppapi_preferences.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_input_shared.cc',
# 'shared_impl/ppb_audio_shared.cc', 'shared_impl/ppb_audio_shared.cc',
'shared_impl/ppb_crypto_shared.cc', 'shared_impl/ppb_crypto_shared.cc',
'shared_impl/ppb_device_ref_shared.cc', 'shared_impl/ppb_device_ref_shared.cc',
'shared_impl/ppb_file_io_shared.cc', 'shared_impl/ppb_file_io_shared.cc',
...@@ -278,10 +279,10 @@ ...@@ -278,10 +279,10 @@
'shared_impl/var_tracker.cc', 'shared_impl/var_tracker.cc',
'thunk/enter.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_thunk.cc',
# 'thunk/ppb_audio_input_trusted_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_audio_trusted_thunk.cc',
# 'thunk/ppb_broker_thunk.cc', # 'thunk/ppb_broker_thunk.cc',
# 'thunk/ppb_browser_font_trusted_thunk.cc', # 'thunk/ppb_browser_font_trusted_thunk.cc',
...@@ -353,7 +354,7 @@ ...@@ -353,7 +354,7 @@
'proxy/ppapi_messages.cc', 'proxy/ppapi_messages.cc',
'proxy/ppapi_param_traits.cc', 'proxy/ppapi_param_traits.cc',
# 'proxy/ppb_audio_input_proxy.cc', # 'proxy/ppb_audio_input_proxy.cc',
# 'proxy/ppb_audio_proxy.cc', 'proxy/ppb_audio_proxy.cc',
# 'proxy/ppb_broker_proxy.cc', # 'proxy/ppb_broker_proxy.cc',
# 'proxy/ppb_buffer_proxy.cc', # 'proxy/ppb_buffer_proxy.cc',
'proxy/ppb_core_proxy.cc', 'proxy/ppb_core_proxy.cc',
......
...@@ -157,9 +157,12 @@ PP_Resource PPB_Audio_Proxy::CreateProxyResource( ...@@ -157,9 +157,12 @@ PP_Resource PPB_Audio_Proxy::CreateProxyResource(
bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPB_Audio_Proxy, msg) 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_Create, OnMsgCreate)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop,
OnMsgStartOrStop) OnMsgStartOrStop)
#endif
IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated,
OnMsgNotifyAudioStreamCreated) OnMsgNotifyAudioStreamCreated)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
...@@ -167,6 +170,7 @@ bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { ...@@ -167,6 +170,7 @@ bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) {
return handled; return handled;
} }
#if !defined(OS_NACL)
void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
int32_t sample_rate, int32_t sample_rate,
uint32_t sample_frame_count, uint32_t sample_frame_count,
...@@ -228,28 +232,6 @@ void PPB_Audio_Proxy::OnMsgStartOrStop(const HostResource& audio_id, ...@@ -228,28 +232,6 @@ void PPB_Audio_Proxy::OnMsgStartOrStop(const HostResource& audio_id,
enter.object()->StopPlayback(); 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( void PPB_Audio_Proxy::AudioChannelConnected(
int32_t result, int32_t result,
const HostResource& resource) { const HostResource& resource) {
...@@ -312,6 +294,29 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles( ...@@ -312,6 +294,29 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles(
return PP_OK; 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 proxy
} // namespace ppapi } // namespace ppapi
...@@ -172,7 +172,6 @@ PP_Resource ResourceCreationProxy::CreateWheelInputEvent( ...@@ -172,7 +172,6 @@ PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
instance, data))->GetReference(); instance, data))->GetReference();
} }
#if !defined(OS_NACL)
PP_Resource ResourceCreationProxy::CreateAudio( PP_Resource ResourceCreationProxy::CreateAudio(
PP_Instance instance, PP_Instance instance,
PP_Resource config_id, PP_Resource config_id,
...@@ -190,8 +189,9 @@ PP_Resource ResourceCreationProxy::CreateAudioConfig( ...@@ -190,8 +189,9 @@ PP_Resource ResourceCreationProxy::CreateAudioConfig(
OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count); OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count);
} }
#if !defined(OS_NACL)
PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { 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; return 0;
} }
......
...@@ -72,7 +72,6 @@ class ResourceCreationProxy : public InterfaceProxy, ...@@ -72,7 +72,6 @@ class ResourceCreationProxy : public InterfaceProxy,
const PP_FloatPoint* wheel_ticks, const PP_FloatPoint* wheel_ticks,
PP_Bool scroll_by_page) OVERRIDE; PP_Bool scroll_by_page) OVERRIDE;
#if !defined(OS_NACL)
virtual PP_Resource CreateAudio(PP_Instance instance, virtual PP_Resource CreateAudio(PP_Instance instance,
PP_Resource config_id, PP_Resource config_id,
PPB_Audio_Callback audio_callback, PPB_Audio_Callback audio_callback,
...@@ -80,6 +79,7 @@ class ResourceCreationProxy : public InterfaceProxy, ...@@ -80,6 +79,7 @@ class ResourceCreationProxy : public InterfaceProxy,
virtual PP_Resource CreateAudioConfig(PP_Instance instance, virtual PP_Resource CreateAudioConfig(PP_Instance instance,
PP_AudioSampleRate sample_rate, PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) OVERRIDE; uint32_t sample_frame_count) OVERRIDE;
#if !defined(OS_NACL)
virtual PP_Resource CreateAudioTrusted(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateAudioTrusted(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateAudioInput0_1( virtual PP_Resource CreateAudioInput0_1(
PP_Instance instance, PP_Instance instance,
......
...@@ -78,15 +78,15 @@ class ResourceCreationAPI { ...@@ -78,15 +78,15 @@ class ResourceCreationAPI {
const PP_FloatPoint* wheel_ticks, const PP_FloatPoint* wheel_ticks,
PP_Bool scroll_by_page) = 0; PP_Bool scroll_by_page) = 0;
#if !defined(OS_NACL)
virtual PP_Resource CreateAudio(PP_Instance instance, virtual PP_Resource CreateAudio(PP_Instance instance,
PP_Resource config_id, PP_Resource config_id,
PPB_Audio_Callback audio_callback, PPB_Audio_Callback audio_callback,
void* user_data) = 0; void* user_data) = 0;
virtual PP_Resource CreateAudioTrusted(PP_Instance instance) = 0;
virtual PP_Resource CreateAudioConfig(PP_Instance instance, virtual PP_Resource CreateAudioConfig(PP_Instance instance,
PP_AudioSampleRate sample_rate, PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) = 0; uint32_t sample_frame_count) = 0;
#if !defined(OS_NACL)
virtual PP_Resource CreateAudioTrusted(PP_Instance instance) = 0;
virtual PP_Resource CreateAudioInput0_1( virtual PP_Resource CreateAudioInput0_1(
PP_Instance instance, PP_Instance instance,
PP_Resource config_id, PP_Resource config_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment