| Index: ppapi/shared_impl/resource_var.h
|
| diff --git a/ppapi/shared_impl/resource_var.h b/ppapi/shared_impl/resource_var.h
|
| index 70eabc6cfb56ab426618ea14ba3ed1ae4595e62b..0b8bab2354cddd74d62607a1fcf461a71bbc27e0 100644
|
| --- a/ppapi/shared_impl/resource_var.h
|
| +++ b/ppapi/shared_impl/resource_var.h
|
| @@ -5,42 +5,34 @@
|
| #ifndef PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
|
| #define PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
|
|
|
| -#include "ipc/ipc_message.h"
|
| #include "ppapi/c/pp_resource.h"
|
| #include "ppapi/c/pp_var.h"
|
| #include "ppapi/shared_impl/ppapi_shared_export.h"
|
| #include "ppapi/shared_impl/var.h"
|
|
|
| +namespace IPC {
|
| +class Message;
|
| +}
|
| +
|
| namespace ppapi {
|
|
|
| // Represents a resource Var.
|
| class PPAPI_SHARED_EXPORT ResourceVar : public Var {
|
| public:
|
| - // Makes a null resource var.
|
| - ResourceVar();
|
| -
|
| - // Makes a resource var with an existing plugin-side resource.
|
| - explicit ResourceVar(PP_Resource pp_resource);
|
| -
|
| - // Makes a resource var with a pending resource host.
|
| - // The |creation_message| contains instructions on how to create the
|
| - // plugin-side resource. Its type depends on the type of resource.
|
| - explicit ResourceVar(const IPC::Message& creation_message);
|
| -
|
| - virtual ~ResourceVar();
|
| -
|
| // Gets the resource ID associated with this var.
|
| - // This is 0 if a resource is still pending.
|
| - PP_Resource pp_resource() const { return pp_resource_; }
|
| + // This is 0 if a resource is still pending (only possible on the host side).
|
| + // NOTE: This can return a PP_Resource with a reference count of 0 on the
|
| + // plugin side. It should be AddRef'd if the resource is passed to the user.
|
| + virtual PP_Resource GetPPResource() const = 0;
|
|
|
| - // Gets the message for creating a plugin-side resource.
|
| - // May be an empty message.
|
| - const IPC::Message& creation_message() const { return creation_message_; }
|
| + // Gets the message for creating a plugin-side resource. Returns NULL if the
|
| + // message is empty (which is always true on the plugin side).
|
| + virtual const IPC::Message* GetCreationMessage() const;
|
|
|
| // Determines whether this is a pending resource.
|
| - // This is true if the pp_resource is 0 and there is a non-empty
|
| - // creation_message.
|
| - bool IsPending() const;
|
| + // This is true if, on the host side, the there is a creation_message and no
|
| + // PP_Resource.
|
| + virtual bool IsPending() const = 0;
|
|
|
| // Var override.
|
| virtual ResourceVar* AsResourceVar() OVERRIDE;
|
| @@ -50,16 +42,12 @@ class PPAPI_SHARED_EXPORT ResourceVar : public Var {
|
| // return NULL if the PP_Var is not of Resource type.
|
| static ResourceVar* FromPPVar(PP_Var var);
|
|
|
| - private:
|
| - // Real resource ID in the plugin. 0 if one has not yet been created
|
| - // (indicating that there is a pending host resource).
|
| - PP_Resource pp_resource_;
|
| + protected:
|
| + ResourceVar();
|
|
|
| - // If the plugin-side resource has not yet been created, carries a message to
|
| - // create a resource of the specific type on the plugin side.
|
| - // Otherwise, carries an empty message.
|
| - IPC::Message creation_message_;
|
| + virtual ~ResourceVar();
|
|
|
| + private:
|
| DISALLOW_COPY_AND_ASSIGN(ResourceVar);
|
| };
|
|
|
|
|