summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_audio_proxy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/proxy/ppb_audio_proxy.cc')
-rw-r--r--ppapi/proxy/ppb_audio_proxy.cc33
1 files changed, 9 insertions, 24 deletions
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 139df10..453d7b0 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -116,11 +116,6 @@ int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) {
namespace {
-InterfaceProxy* CreateAudioProxy(Dispatcher* dispatcher,
- const void* target_interface) {
- return new PPB_Audio_Proxy(dispatcher, target_interface);
-}
-
base::PlatformFile IntToPlatformFile(int32_t handle) {
// TODO(piman/brettw): Change trusted interface to return a PP_FileHandle,
// those casts are ugly.
@@ -135,9 +130,8 @@ base::PlatformFile IntToPlatformFile(int32_t handle) {
} // namespace
-PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher,
- const void* target_interface)
- : InterfaceProxy(dispatcher, target_interface),
+PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher)
+ : InterfaceProxy(dispatcher),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -145,18 +139,6 @@ PPB_Audio_Proxy::~PPB_Audio_Proxy() {
}
// static
-const InterfaceProxy::Info* PPB_Audio_Proxy::GetInfo() {
- static const Info info = {
- thunk::GetPPB_Audio_Thunk(),
- PPB_AUDIO_INTERFACE,
- INTERFACE_ID_PPB_AUDIO,
- false,
- &CreateAudioProxy,
- };
- return &info;
-}
-
-// static
PP_Resource PPB_Audio_Proxy::CreateProxyResource(
PP_Instance instance_id,
PP_Resource config_id,
@@ -242,16 +224,19 @@ void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
// Clean up the temporary audio config resource we made.
const PPB_Core* core = static_cast<const PPB_Core*>(
- dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE));
+ dispatcher()->local_get_interface()(PPB_CORE_INTERFACE));
core->ReleaseResource(audio_config_res);
}
void PPB_Audio_Proxy::OnMsgStartOrStop(const HostResource& audio_id,
bool play) {
+ EnterHostFromHostResource<PPB_Audio_API> enter(audio_id);
+ if (enter.failed())
+ return;
if (play)
- ppb_audio_target()->StartPlayback(audio_id.host_resource());
+ enter.object()->StartPlayback();
else
- ppb_audio_target()->StopPlayback(audio_id.host_resource());
+ enter.object()->StopPlayback();
}
// Processed in the plugin (message from host).
@@ -307,7 +292,7 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles(
base::SharedMemoryHandle* foreign_shared_memory_handle,
uint32_t* shared_memory_length) {
// Get the audio interface which will give us the handles.
- EnterResourceNoLock<PPB_Audio_API> enter(resource.host_resource(), false);
+ EnterHostFromHostResource<PPB_Audio_API> enter(resource);
if (enter.failed())
return PP_ERROR_NOINTERFACE;