Mercurial > projects > dstep
annotate dstep/foundation/NSAutoreleasePool.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children | b9de51448c6b |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSAutoreleasePool; | |
8 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
9 import dstep.foundation.NSDebug; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
10 import dstep.foundation.NSObjCRuntime; |
14 | 11 import dstep.foundation.NSObject; |
12 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
13 import dstep.objc.objc; |
14 | 14 |
15 class NSAutoreleasePool : NSObject | |
16 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
17 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
18 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
19 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 } |
14 | 28 |
29 static void addObject (Object anObject) | |
30 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 return invokeObjcSuperClass!(void, "addObject:", Object)(anObject); |
14 | 32 } |
33 | |
34 void addObject (Object anObject) | |
35 { | |
36 return invokeObjcSelf!(void, "addObject:", Object)(anObject); | |
37 } | |
38 | |
39 void drain () | |
40 { | |
41 return invokeObjcSelf!(void, "drain"); | |
42 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
44 // NSAutoreleasePoolDebugging |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
45 static void enableRelease (bool enable) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
46 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
47 return invokeObjcSuperClass!(void, "enableRelease:", bool)(enable); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
49 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
50 static void showPools () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
51 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
52 return invokeObjcSuperClass!(void, "showPools"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
53 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
54 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
55 static void resetTotalAutoreleasedObjects () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
56 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
57 return invokeObjcSuperClass!(void, "resetTotalAutoreleasedObjects"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
58 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
59 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
60 static NSUInteger totalAutoreleasedObjects () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
61 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
62 return invokeObjcSuperClass!(NSUInteger, "totalAutoreleasedObjects"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
63 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
64 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
65 static void enableFreedObjectCheck (bool enable) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
66 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
67 return invokeObjcSuperClass!(void, "enableFreedObjectCheck:", bool)(enable); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
68 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
69 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
70 static NSUInteger autoreleasedObjectCount () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
71 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
72 return invokeObjcSuperClass!(NSUInteger, "autoreleasedObjectCount"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
74 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
75 static NSUInteger topAutoreleasePoolCount () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
76 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
77 return invokeObjcSuperClass!(NSUInteger, "topAutoreleasePoolCount"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
78 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
79 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
80 static NSUInteger poolCountHighWaterMark () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
81 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
82 return invokeObjcSuperClass!(NSUInteger, "poolCountHighWaterMark"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
83 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
84 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
85 static void setPoolCountHighWaterMark (NSUInteger count) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
86 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
87 return invokeObjcSuperClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
88 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
89 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
90 static NSUInteger poolCountHighWaterResolution () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
91 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
92 return invokeObjcSuperClass!(NSUInteger, "poolCountHighWaterResolution"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
93 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
94 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
95 static void setPoolCountHighWaterResolution (NSUInteger res) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
96 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
97 return invokeObjcSuperClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
98 } |
14 | 99 } |
100 |