summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/resource_object_base.cc8
-rw-r--r--ppapi/shared_impl/resource_object_base.h9
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