diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 18:09:37 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 18:09:37 +0000 |
commit | 5c966027630633c4591f4f7ea2f76fd7c04682d9 (patch) | |
tree | 827b42c5cad66fa01fa1d6a3fe67aa598b399537 /ppapi/proxy/ppb_audio_proxy.cc | |
parent | 35eab12c495bfc7b56b57f0074eb1ed3f1969d09 (diff) | |
download | chromium_src-5c966027630633c4591f4f7ea2f76fd7c04682d9.zip chromium_src-5c966027630633c4591f4f7ea2f76fd7c04682d9.tar.gz chromium_src-5c966027630633c4591f4f7ea2f76fd7c04682d9.tar.bz2 |
s patch tries to remove most of the manual registration for Pepper interfaces, and replaces it with a list of macros. When files want to know which Pepper interface names and structs there are, they define what they want to do with the macros, and then include the relevant files for the classes of interfaces they want (stable, private, dev).
This re-lands my previous change.
Original Review URL: http://codereview.chromium.org/7874002
This does not convert all the dev interfaces. I just did a few to keep the patch smaller. So there is still a lot of manual registration.
This fixes the previous design problem where we assumed one *_Proxy object == one interface. We have been hacking around this lately with duplicate GetInfo calls, but this doesn't work for PPP interfaces.
Now, a _Proxy object is just there to help keep things organized. One proxy can handle zero, one, or many interfaces, and this mapping is controlled by just one line in the interfaces file.
So for example, to add a new function to a new version of an interface with backward compatibility, you would add that function to the _api.h file, and write a thunk for the new interface. Then you only need to add one line to the interfaces_ppb_public_stable.h file and that will be hooked up with the proxy and the implementation.
This removes some _proxy objects/files that were used only to declare that the interfaces existed, since they're no longer necessary.
I folded Console into the Instance API which removed a bunch of code.
I removed FileChooser 0.4. I think everybody has converted to the new one, and I think parts of it weren't even hooked up properly anymore.
Review URL: http://codereview.chromium.org/7887001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_audio_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.cc | 33 |
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; |