diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 15:41:01 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 15:41:01 +0000 |
commit | 7f8b26b5f223689de7af4803bc07e1e953ff5953 (patch) | |
tree | d6f3e574d97c6253b8b202264fe23dea1b489dc2 /ppapi/proxy/ppb_flash_proxy.cc | |
parent | d8886526085a42874663be638be1421e78f6172c (diff) | |
download | chromium_src-7f8b26b5f223689de7af4803bc07e1e953ff5953.zip chromium_src-7f8b26b5f223689de7af4803bc07e1e953ff5953.tar.gz chromium_src-7f8b26b5f223689de7af4803bc07e1e953ff5953.tar.bz2 |
Add a unified resource tracker shared between the proxy and the impl.
This renames the old ResourceObjectBase to Resource and removes the old
PluginResource. It moves the resource tracker from the impl to the
shared_impl, and makes the proxy use it.
Some things become a little less neat because there's no proxy resource base
class. In particular GetDispatcher() is now gone. I considered whether to
add a helper base class that provides this function, but decided against it
and had individual resource classes implement this when their implementation
would find it useful. This is because ultimately I want more of this
functionality to move into the shared_impl, and it's easier to do that if
there are fewer proxy-specific things in the resources.
This changes the way that plugins are added to the tracker. Previously they
would only be in the tracker if the plugin had a reference to them, although
they could be alive if the impl had a scoped_ptr referencing an object. This
actually has the bug that if we then give the resource back to the plugin,
it wouldn't be refcounted properly and everything would get confused.
Now the tracker tracks all live resource objects whether or not the plugin
has a ref. This works basically like the var tracker (it would be nice if
the var and resource trackers shared more code, but that would further
complicate this already overcomplicated patch). The resource tracker takes an
extra ref whenever the plugin has one or more, and otherwise just tracks live
resources.
Review URL: http://codereview.chromium.org/7629017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_flash_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 289a864..bbe7018 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -14,12 +14,14 @@ #include "ppapi/c/private/ppb_flash.h" #include "ppapi/proxy/host_dispatcher.h" #include "ppapi/proxy/plugin_dispatcher.h" -#include "ppapi/proxy/plugin_resource.h" +#include "ppapi/proxy/plugin_resource_tracker.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/proxy_module.h" #include "ppapi/proxy/serialized_var.h" +#include "ppapi/shared_impl/resource.h" using ppapi::HostResource; +using ppapi::Resource; namespace pp { namespace proxy { @@ -44,17 +46,17 @@ PP_Bool DrawGlyphs(PP_Instance instance, uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) { - PluginResource* image_data = PluginResourceTracker::GetInstance()-> - GetResourceObject(pp_image_data); + Resource* image_data = PluginResourceTracker::GetInstance()->GetResource( + 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) + if (image_data->pp_instance() != instance) return PP_FALSE; PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( - image_data->instance()); + image_data->pp_instance()); if (!dispatcher) return PP_FALSE; @@ -96,13 +98,13 @@ PP_Var GetProxyForURL(PP_Instance instance, const char* url) { int32_t Navigate(PP_Resource request_id, const char* target, bool from_user_action) { - PluginResource* request_object = - PluginResourceTracker::GetInstance()->GetResourceObject(request_id); + Resource* request_object = + PluginResourceTracker::GetInstance()->GetResource(request_id); if (!request_object) return PP_ERROR_BADRESOURCE; PluginDispatcher* dispatcher = - PluginDispatcher::GetForInstance(request_object->instance()); + PluginDispatcher::GetForInstance(request_object->pp_instance()); if (!dispatcher) return PP_ERROR_FAILED; |