Reviewed by Eric.
[WebKit-https.git] / JavaScriptGlue / JSBase.cpp
1 //
2 // JSBase.cpp
3 //
4
5 #include "JSBase.h"
6
7 JSBase::JSBase(JSTypeID type) : fTypeID(type), fRetainCount(1)
8 {
9 }
10
11 JSBase::~JSBase()
12 {
13 }
14
15 JSBase* JSBase::Retain()
16 {
17     fRetainCount++; return this;
18 }
19
20 void JSBase::Release()
21 {
22     if (--fRetainCount == 0)
23     {
24         delete this;
25     }
26 }
27
28 CFIndex JSBase::RetainCount() const
29 {
30     return fRetainCount;
31 }
32
33 JSTypeID JSBase::GetTypeID() const
34 {
35     return fTypeID;
36 }
37
38 CFStringRef JSBase::CopyDescription()
39 {
40     return CFStringCreateWithFormat(
41                 0,
42                 0,
43                 CFSTR("<JSTypeRef- ptr:0x%lx type: %d, retaincount: %ld>"),
44                 (long)this,
45                 (int)fTypeID,
46                 (long)fRetainCount);
47 }
48
49 UInt8 JSBase::Equal(JSBase* other)
50 {
51     return this == other;
52 }