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_flash_proxy.cc | |
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_flash_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 014cea3..6ff1cb5 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -67,13 +67,22 @@ PP_Bool DrawGlyphs(PP_Instance instance, uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) { - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + PluginResource* image_data = PluginResourceTracker::GetInstance()-> + GetResourceObject(pp_image_data); + if (!image_data) + return PP_FALSE; + // The instance parameter isn't strictly necessary but we check that it + // matches anyway. + if (image_data->instance() != instance) + return PP_FALSE; + + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( + image_data->instance()); if (!dispatcher) return PP_FALSE; PPBFlash_DrawGlyphs_Params params; - params.instance = instance, - params.pp_image_data = pp_image_data; + params.image_data = image_data->host_resource(); params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true); params.color = color; params.position = position; @@ -305,8 +314,9 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs( return; *result = ppb_flash_target()->DrawGlyphs( - params.instance, params.pp_image_data, &font_desc, params.color, - params.position, params.clip, + 0, // Unused instance param. + params.image_data.host_resource(), &font_desc, + params.color, params.position, params.clip, const_cast<float(*)[3]>(params.transformation), static_cast<uint32_t>(params.glyph_indices.size()), const_cast<uint16_t*>(¶ms.glyph_indices[0]), |