summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/resource.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 00:27:04 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 00:27:04 +0000
commit00d320a6e403c645dc00d47217028aef5f2792a0 (patch)
tree4cb1feea9a8c9819c95d1520db3ebd2dff69a3c6 /ppapi/shared_impl/resource.h
parent2354c0fa1003d87661d20255211306ae4c9cf622 (diff)
downloadchromium_src-00d320a6e403c645dc00d47217028aef5f2792a0.zip
chromium_src-00d320a6e403c645dc00d47217028aef5f2792a0.tar.gz
chromium_src-00d320a6e403c645dc00d47217028aef5f2792a0.tar.bz2
Make a global enum to differentiate impl & proxy.
Use this in resource constructors and remove all the old weird structs that we used to tell which one to call. This removes some extra code we had to deal with this. Review URL: http://codereview.chromium.org/9391013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/resource.h')
-rw-r--r--ppapi/shared_impl/resource.h45
1 files changed, 36 insertions, 9 deletions
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 4b26d28..b0876a2 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -69,17 +69,44 @@ FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS)
#undef DECLARE_RESOURCE_CLASS
} // namespace thunk
+// Resources have slightly different registration behaviors when the're an
+// in-process ("impl") resource in the host (renderer) process, or when they're
+// a proxied resource in the plugin process. This enum differentiates those
+// cases.
+enum ResourceObjectType {
+ OBJECT_IS_IMPL,
+ OBJECT_IS_PROXY
+};
+
class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> {
public:
- // For constructing non-proxied objects. This just takes the associated
- // instance, and generates a new resource ID. The host resource will be the
- // same as the newly-generated resource ID.
- explicit Resource(PP_Instance instance);
-
- // For constructing proxied objects. This takes the resource generated in
- // the host side, stores it, and allocates a "local" resource ID for use in
- // the current process.
- explicit Resource(const HostResource& host_resource);
+ // Constructor for impl and non-proxied, instance-only objects.
+ //
+ // For constructing "impl" (non-proxied) objects, this just takes the
+ // associated instance, and generates a new resource ID. The host resource
+ // will be the same as the newly-generated resource ID. For all objects in
+ // the renderer (host) process, you'll use this constructor and call it with
+ // OBJECT_IS_IMPL.
+ //
+ // For proxied objects, this will create an "instance-only" object which
+ // lives only in the plugin and doesn't have a corresponding object in the
+ // host. If you have a host resource ID, use the constructor below which
+ // takes that HostResource value.
+ explicit Resource(ResourceObjectType type, PP_Instance instance);
+
+ // For constructing given a host resource.
+ //
+ // For OBJECT_IS_PROXY objects, this takes the resource generated in the host
+ // side, stores it, and allocates a "local" resource ID for use in the
+ // current process.
+ //
+ // For OBJECT_IS_IMPL, the host resource ID must be 0, since there should be
+ // no host resource generated (impl objects should generate their own). The
+ // reason for supporting this constructor at all for the IMPL case is that
+ // some shared objects use a host resource for both modes to keep things the
+ // same.
+ explicit Resource(ResourceObjectType type,
+ const HostResource& host_resource);
virtual ~Resource();