Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: ppapi/shared_impl/resource.h

Issue 9391013: Make a global enum to differentiate impl & proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/private/udp_socket_private_impl.cc ('k') | ppapi/shared_impl/resource.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/resource.h
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 4b26d2865e1916358dc4f7ff26a6d25f4fc67453..b0876a22133f7168e5864b3c786fd481b6e04342 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);
dmichael (off chromium) 2012/02/13 22:24:40 Will this one ever be called with OBJECT_IS_IMPL?
brettw 2012/02/13 22:28:28 Yes, in ppb_file_ref_shared.cc. That class needs t
virtual ~Resource();
« no previous file with comments | « ppapi/shared_impl/private/udp_socket_private_impl.cc ('k') | ppapi/shared_impl/resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698