diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-27 20:40:39 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-27 20:40:39 +0000 |
commit | f24448db9f893c5dde10ed1ae4cead436e18f64f (patch) | |
tree | c224a27ed5949a761ed2f62b75cedae0fa2014e2 /ppapi/proxy/ppb_audio_proxy.h | |
parent | e9319bf33e2b7e6bdd2fa005b212f2fcf0896883 (diff) | |
download | chromium_src-f24448db9f893c5dde10ed1ae4cead436e18f64f.zip chromium_src-f24448db9f893c5dde10ed1ae4cead436e18f64f.tar.gz chromium_src-f24448db9f893c5dde10ed1ae4cead436e18f64f.tar.bz2 |
Refactor PPAPI proxy resource handling to maintain which host they came from,
and to map back to that host when calling functions on them. Adds a mapping
between resources generated by the hosts to a new list inside the plugin so
there can't be overlaps.
This means there are now two meanings for a PP_Resource, one in the plugin
process and one in the host process. This is potentially very confusing. I
introduced a new object called a HostResource that always represents a
"host" PP_Resource to try to prevent errors. In the plugin side of the proxy,
it only deals with PP_Resources valid in the plugin, and SerializedResources
valid in the host. It also encapsulates the associated instance, which
simplifies some code.
Each PluginResource object maintains its SerializedResource which the proxy
uses to send to the host for requests. This requires getting the PluginResource
object in more proxy calls.
This fixes a bug in var sending introduced in my previous patch. The var
releasing from EndSendPassRef used the host var rather than the plugin var. I
had to add more plumbing to get the dispatcher at this location and convert
to a plugin var.
I removed the separate file for ImageData and put it in ppb_image_data_proxy
like for the other resource types.
TEST=some unit tests included
BUG=none
Review URL: http://codereview.chromium.org/6334016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_audio_proxy.h')
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/ppapi/proxy/ppb_audio_proxy.h b/ppapi/proxy/ppb_audio_proxy.h index c77e3d6..7ac27f5 100644 --- a/ppapi/proxy/ppb_audio_proxy.h +++ b/ppapi/proxy/ppb_audio_proxy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,6 +21,9 @@ struct PPB_Audio; namespace pp { namespace proxy { +struct PPBAudio_NotifyAudioStreamCreated_Params; +class HostResource; + class PPB_Audio_Proxy : public InterfaceProxy { public: PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface); @@ -38,19 +41,16 @@ class PPB_Audio_Proxy : public InterfaceProxy { private: // Plugin->renderer message handlers. void OnMsgCreate(PP_Instance instance_id, - PP_Resource config_id, - PP_Resource* result); - void OnMsgStartOrStop(PP_Resource audio_id, bool play); + const HostResource& config_id, + HostResource* result); + void OnMsgStartOrStop(const HostResource& audio_id, bool play); // Renderer->plugin message handlers. void OnMsgNotifyAudioStreamCreated( - PP_Resource audio_id, - int32_t result_code, - IPC::PlatformFileForTransit socket_handle, - base::SharedMemoryHandle shared_memory_handle, - uint32_t shared_memory_length); + const PPBAudio_NotifyAudioStreamCreated_Params& params); - void AudioChannelConnected(int32_t result, PP_Resource resource); + void AudioChannelConnected(int32_t result, + const HostResource& resource); // In the renderer, this is called in response to a stream created message. // It will retrieve the shared memory and socket handles and place them into @@ -61,7 +61,7 @@ class PPB_Audio_Proxy : public InterfaceProxy { // arguments may be written to, and others may be untouched, depending on // where the error occurred. int32_t GetAudioConnectedHandles( - PP_Resource resource, + const HostResource& resource, IPC::PlatformFileForTransit* foreign_socket_handle, base::SharedMemoryHandle* foreign_shared_memory_handle, uint32_t* shared_memory_length); |