summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_audio_proxy.cc
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-19 01:39:05 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-19 01:39:05 +0000
commit771fc8dd423146436f1c431ef0bfdde382854a0f (patch)
treecd2915c32ec4ae45a4175e628abf79e0861fcaae /ppapi/proxy/ppb_audio_proxy.cc
parentc5fb6520d76ffd57cf453b0b9e54c1bcd8aed922 (diff)
downloadchromium_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
Diffstat (limited to 'ppapi/proxy/ppb_audio_proxy.cc')
-rw-r--r--ppapi/proxy/ppb_audio_proxy.cc49
1 files changed, 27 insertions, 22 deletions
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