summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-07-31 11:52:57 +1000
committerWarwick Allison <warwick.allison@nokia.com>2009-07-31 11:52:57 +1000
commitaa9cf406d62004519ad54596e1c391f9a6439210 (patch)
treedd562b9c296981f2761b76623911be8496c7af84 /src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
parent987aec28b950e1c9817a20a9dd71afc071cd93ea (diff)
parent56b6a5924008ab5cdbae36e9662eddba923acd5e (diff)
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
index c174145dc..761a8566f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
@@ -29,7 +29,7 @@ namespace WTF {
// This base class holds the non-template methods and attributes.
// The RefCounted class inherits from it reducing the template bloat
// generated by the compiler (technique called template hoisting).
-class RefCountedBase : Noncopyable {
+class RefCountedBase {
public:
void ref()
{
@@ -101,7 +101,7 @@ private:
};
-template<class T> class RefCounted : public RefCountedBase {
+template<class T> class RefCounted : public RefCountedBase, public Noncopyable {
public:
void deref()
{
@@ -115,8 +115,23 @@ protected:
}
};
+template<class T> class RefCountedCustomAllocated : public RefCountedBase, public NoncopyableCustomAllocated {
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ ~RefCountedCustomAllocated()
+ {
+ }
+};
+
} // namespace WTF
using WTF::RefCounted;
+using WTF::RefCountedCustomAllocated;
#endif // RefCounted_h