Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: ppapi/proxy/ppb_audio_proxy.cc

Issue 7740038: Use macros to define pepper interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/ppb_audio_proxy.cc
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 139df10cc9eca8db21b13b80931f2434bca7a993..453d7b0a61fd344a0c3ad84dcc7fbe498260de12 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;

Powered by Google App Engine
This is Rietveld 408576698