diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 22:30:23 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 22:30:23 +0000 |
commit | a3719b61c74891c09217bc9be48f2bec596c4f42 (patch) | |
tree | e79325dcf2011105a102e4b7f0e5767d2b166921 /ppapi/shared_impl | |
parent | 3aada4606c2498160995b748fea85aa489269176 (diff) | |
download | chromium_src-a3719b61c74891c09217bc9be48f2bec596c4f42.zip chromium_src-a3719b61c74891c09217bc9be48f2bec596c4f42.tar.gz chromium_src-a3719b61c74891c09217bc9be48f2bec596c4f42.tar.bz2 |
Add the PP_Instance to resource object base.
This will allow us to get the instance for a resource consistently in the
proxy and webkit glue.
Review URL: http://codereview.chromium.org/7461147
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r-- | ppapi/shared_impl/resource_object_base.cc | 8 | ||||
-rw-r--r-- | ppapi/shared_impl/resource_object_base.h | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/ppapi/shared_impl/resource_object_base.cc b/ppapi/shared_impl/resource_object_base.cc index 4c0a9af..27ef9e9 100644 --- a/ppapi/shared_impl/resource_object_base.cc +++ b/ppapi/shared_impl/resource_object_base.cc @@ -4,8 +4,16 @@ #include "ppapi/shared_impl/resource_object_base.h" +#include "base/logging.h" + namespace ppapi { +ResourceObjectBase::ResourceObjectBase(PP_Instance instance) + : pp_instance_(instance) { + // Instance should be valid (nonzero). + DCHECK(instance); +} + ResourceObjectBase::~ResourceObjectBase() { } diff --git a/ppapi/shared_impl/resource_object_base.h b/ppapi/shared_impl/resource_object_base.h index 8f5da77..3408525 100644 --- a/ppapi/shared_impl/resource_object_base.h +++ b/ppapi/shared_impl/resource_object_base.h @@ -8,6 +8,7 @@ #include <stddef.h> // For NULL. #include "base/memory/ref_counted.h" +#include "ppapi/c/pp_instance.h" #define FOR_ALL_PPAPI_RESOURCE_APIS(F) \ F(PPB_AudioConfig_API) \ @@ -55,8 +56,11 @@ FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS) class ResourceObjectBase : public base::RefCounted<ResourceObjectBase> { public: + ResourceObjectBase(PP_Instance instance); virtual ~ResourceObjectBase(); + PP_Instance pp_instance() const { return pp_instance_; } + // Dynamic casting for this object. Returns the pointer to the given type if // Inheritance-based dynamic casting for this object. Returns the pointer to // the given type if it's supported. Derived classes override the functions @@ -68,6 +72,11 @@ class ResourceObjectBase : public base::RefCounted<ResourceObjectBase> { // Template-based dynamic casting. See specializations below. template <typename T> T* GetAs() { return NULL; } + + private: + PP_Instance pp_instance_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceObjectBase); }; // Template-based dynamic casting. These specializations forward to the |