comparison dwt/browser/DownloadFactory.d @ 348:9a4d7706df52

Test Update to fix linux XPCOM interface issues
author John Reimer <terminal.node@gmail.com>
date Fri, 31 Oct 2008 21:46:44 -0700
parents 5abc6f7f7a95
children
comparison
equal deleted inserted replaced
347:ff6dd48f5248 348:9a4d7706df52
25 class DownloadFactory : nsIFactory { 25 class DownloadFactory : nsIFactory {
26 int refCount = 0; 26 int refCount = 0;
27 27
28 this () {} 28 this () {}
29 29
30 extern(System)
30 nsrefcnt AddRef () { 31 nsrefcnt AddRef () {
31 refCount++; 32 refCount++;
32 return refCount; 33 return refCount;
33 } 34 }
34 35
36 extern(System)
35 nsresult QueryInterface (nsID* riid, void** ppvObject) { 37 nsresult QueryInterface (nsID* riid, void** ppvObject) {
36 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; 38 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
37 39
38 if (*riid == nsISupports.IID) { 40 if (*riid == nsISupports.IID) {
39 *ppvObject = cast(void*)cast(nsISupports)this; 41 *ppvObject = cast(void*)cast(nsISupports)this;
47 } 49 }
48 50
49 *ppvObject = null; 51 *ppvObject = null;
50 return XPCOM.NS_ERROR_NO_INTERFACE; 52 return XPCOM.NS_ERROR_NO_INTERFACE;
51 } 53 }
52 54
55 extern(System)
53 nsrefcnt Release () { 56 nsrefcnt Release () {
54 refCount--; 57 refCount--;
55 //if (refCount is 0) disposeCOMInterfaces (); 58 //if (refCount is 0) disposeCOMInterfaces ();
56 return refCount; 59 return refCount;
57 } 60 }
58 61
59 /* nsIFactory */ 62 /* nsIFactory */
60 63
64 extern(System)
61 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { 65 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) {
62 if (result is null) 66 if (result is null)
63 return XPCOM.NS_ERROR_INVALID_ARG; 67 return XPCOM.NS_ERROR_INVALID_ARG;
64 auto download = new Download(); 68 auto download = new Download();
65 nsresult rv = download.QueryInterface( iid, result ); 69 nsresult rv = download.QueryInterface( iid, result );
68 delete download; 72 delete download;
69 } 73 }
70 return rv; 74 return rv;
71 } 75 }
72 76
77 extern(System)
73 nsresult LockFactory (int lock) { 78 nsresult LockFactory (int lock) {
74 return XPCOM.NS_OK; 79 return XPCOM.NS_OK;
75 } 80 }
76 } 81 }