summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsObjectBase.h
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-06-16 12:38:55 -0700
committerMathias Agopian <mathias@google.com>2009-06-16 12:38:55 -0700
commit69f066c8fc42b9f0acc5c41f8ffd972f8d6d0584 (patch)
tree3a8bc941200fa85a32a21657ac69ec9beb9a6463 /libs/rs/rsObjectBase.h
parent151e859e0fc3a930bdf6d270d275e69e9eba0cbf (diff)
parentb0b160ae50497966666bcdcaf974eca2643acfd3 (diff)
downloadframeworks_base-69f066c8fc42b9f0acc5c41f8ffd972f8d6d0584.zip
frameworks_base-69f066c8fc42b9f0acc5c41f8ffd972f8d6d0584.tar.gz
frameworks_base-69f066c8fc42b9f0acc5c41f8ffd972f8d6d0584.tar.bz2
Merge commit 'goog/master' into merge_master
Diffstat (limited to 'libs/rs/rsObjectBase.h')
-rw-r--r--libs/rs/rsObjectBase.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/libs/rs/rsObjectBase.h b/libs/rs/rsObjectBase.h
index 7761e49..b2c3338 100644
--- a/libs/rs/rsObjectBase.h
+++ b/libs/rs/rsObjectBase.h
@@ -33,7 +33,14 @@ public:
void incRef() const;
void decRef() const;
+ const char * getName() const {
+ return mName;
+ }
+ void setName(const char *);
+ void setName(const char *, uint32_t len);
+
private:
+ char * mName;
mutable int32_t mRefCount;
@@ -47,6 +54,20 @@ public:
mRef = NULL;
}
+ ObjectBaseRef(const ObjectBaseRef &ref) {
+ mRef = ref.get();
+ if (mRef) {
+ mRef->incRef();
+ }
+ }
+
+ ObjectBaseRef(T *ref) {
+ mRef = ref;
+ if (mRef) {
+ ref->incRef();
+ }
+ }
+
~ObjectBaseRef() {
clear();
}
@@ -55,10 +76,16 @@ public:
if (mRef != ref) {
clear();
mRef = ref;
- ref->incRef();
+ if (mRef) {
+ ref->incRef();
+ }
}
}
+ void set(const ObjectBaseRef &ref) {
+ set(ref.mRef);
+ }
+
void clear() {
if (mRef) {
mRef->decRef();
@@ -77,9 +104,6 @@ public:
protected:
T * mRef;
-private:
- ObjectBaseRef(const ObjectBaseRef &) {};
-
};