summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-03-07 18:04:06 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-07 18:04:06 -0800
commitde6a47a3e9d1a8cb5722b9785f5ffb9046c23918 (patch)
tree65d534f3ed68fc9110ea4bb3910fcf865ffb984b /include
parent10993b2d1e3614073970aad119ffb2cc9bc8f73f (diff)
parentdf6410dce3dae0bdb7e13118b3878079a1dcce03 (diff)
downloadframeworks_base-de6a47a3e9d1a8cb5722b9785f5ffb9046c23918.zip
frameworks_base-de6a47a3e9d1a8cb5722b9785f5ffb9046c23918.tar.gz
frameworks_base-de6a47a3e9d1a8cb5722b9785f5ffb9046c23918.tar.bz2
am df6410dc: Merge "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only" into gingerbread
* commit 'df6410dce3dae0bdb7e13118b3878079a1dcce03': Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only
Diffstat (limited to 'include')
-rw-r--r--include/utils/RefBase.h62
1 files changed, 48 insertions, 14 deletions
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index 9c64ac0..c24c0db 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -31,13 +31,10 @@ template<typename T> class wp;
// ---------------------------------------------------------------------------
-#define COMPARE(_op_) \
+#define COMPARE_WEAK(_op_) \
inline bool operator _op_ (const sp<T>& o) const { \
return m_ptr _op_ o.m_ptr; \
} \
-inline bool operator _op_ (const wp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
inline bool operator _op_ (const T* o) const { \
return m_ptr _op_ o; \
} \
@@ -46,12 +43,18 @@ inline bool operator _op_ (const sp<U>& o) const { \
return m_ptr _op_ o.m_ptr; \
} \
template<typename U> \
-inline bool operator _op_ (const wp<U>& o) const { \
+inline bool operator _op_ (const U* o) const { \
+ return m_ptr _op_ o; \
+}
+
+#define COMPARE(_op_) \
+COMPARE_WEAK(_op_) \
+inline bool operator _op_ (const wp<T>& o) const { \
return m_ptr _op_ o.m_ptr; \
} \
template<typename U> \
-inline bool operator _op_ (const U* o) const { \
- return m_ptr _op_ o; \
+inline bool operator _op_ (const wp<U>& o) const { \
+ return m_ptr _op_ o.m_ptr; \
}
// ---------------------------------------------------------------------------
@@ -274,13 +277,43 @@ public:
inline T* unsafe_get() const { return m_ptr; }
// Operators
-
- COMPARE(==)
- COMPARE(!=)
- COMPARE(>)
- COMPARE(<)
- COMPARE(<=)
- COMPARE(>=)
+
+ COMPARE_WEAK(==)
+ COMPARE_WEAK(!=)
+ COMPARE_WEAK(>)
+ COMPARE_WEAK(<)
+ COMPARE_WEAK(<=)
+ COMPARE_WEAK(>=)
+
+ inline bool operator == (const wp<T>& o) const {
+ return (m_ptr == o.m_ptr) && (m_refs == o.m_refs);
+ }
+ template<typename U>
+ inline bool operator == (const wp<U>& o) const {
+ return m_ptr == o.m_ptr;
+ }
+
+ inline bool operator > (const wp<T>& o) const {
+ return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr);
+ }
+ template<typename U>
+ inline bool operator > (const wp<U>& o) const {
+ return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr);
+ }
+
+ inline bool operator < (const wp<T>& o) const {
+ return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr);
+ }
+ template<typename U>
+ inline bool operator < (const wp<U>& o) const {
+ return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr);
+ }
+ inline bool operator != (const wp<T>& o) const { return m_refs != o.m_refs; }
+ template<typename U> inline bool operator != (const wp<U>& o) const { return !operator == (o); }
+ inline bool operator <= (const wp<T>& o) const { return !operator > (o); }
+ template<typename U> inline bool operator <= (const wp<U>& o) const { return !operator > (o); }
+ inline bool operator >= (const wp<T>& o) const { return !operator < (o); }
+ template<typename U> inline bool operator >= (const wp<U>& o) const { return !operator < (o); }
private:
template<typename Y> friend class sp;
@@ -294,6 +327,7 @@ template <typename T>
TextOutput& operator<<(TextOutput& to, const wp<T>& val);
#undef COMPARE
+#undef COMPARE_WEAK
// ---------------------------------------------------------------------------
// No user serviceable parts below here.