Chromium Code Reviews| Index: ppapi/proxy/plugin_resource.h |
| =================================================================== |
| --- ppapi/proxy/plugin_resource.h (revision 72517) |
| +++ ppapi/proxy/plugin_resource.h (working copy) |
| @@ -9,6 +9,7 @@ |
| #include "ppapi/c/pp_instance.h" |
| #include "ppapi/proxy/plugin_dispatcher.h" |
| #include "ppapi/proxy/plugin_resource_tracker.h" |
| +#include "ppapi/proxy/serialized_resource.h" |
| // If you inherit from resource, make sure you add the class name here. |
| #define FOR_ALL_PLUGIN_RESOURCES(F) \ |
| @@ -18,6 +19,7 @@ |
| F(Font) \ |
| F(Graphics2D) \ |
| F(ImageData) \ |
| + F(MockResource) \ |
| F(PrivateFontFile) \ |
| F(URLLoader) \ |
| F(URLRequestInfo)\ |
| @@ -33,7 +35,7 @@ |
| class PluginResource { |
| public: |
| - PluginResource(PP_Instance instance); |
| + PluginResource(PP_Instance instance, SerializedResource resource); |
| virtual ~PluginResource(); |
| // Returns NULL if the resource is invalid or is a different type. |
| @@ -47,6 +49,14 @@ |
| PP_Instance instance() const { return instance_; } |
| + // Returns a serialized resource containing the host PP_Resource ID (see |
| + // host_resource_ below) for sending to the host process. |
| + // |
| + // Returned by value since a SerializedResource is just a 32-bit number. |
| + SerializedResource host_resource() const { |
| + return host_resource_; |
| + } |
| + |
| private: |
| // Type-specific getters for individual resource types. These will return |
| // NULL if the resource does not match the specified type. Used by the Cast() |
| @@ -59,6 +69,12 @@ |
| // Instance this resource is associated with. |
| PP_Instance instance_; |
| + // The resource ID of the host that this object corresponds to. Inside the |
|
viettrungluu
2011/01/27 16:52:58
I think s/of/in/ would be clearer. (Some people wo
|
| + // plugin we'll remap the resource IDs so we can have many host processes |
| + // each independently generating resources (which may conflict) but the IDs |
| + // in the plugin will all be unique. |
| + SerializedResource host_resource_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(PluginResource); |
| }; |