Mercurial > projects > dwt-linux
comparison dwt/browser/HelperAppLauncherDialogFactory.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 | 942da4b6558a |
children | a3c5f744d03f |
comparison
equal
deleted
inserted
replaced
347:ff6dd48f5248 | 348:9a4d7706df52 |
---|---|
31 | 31 |
32 this () { | 32 this () { |
33 // createCOMInterfaces (); | 33 // createCOMInterfaces (); |
34 } | 34 } |
35 | 35 |
36 extern(System) | |
36 nsrefcnt AddRef () { | 37 nsrefcnt AddRef () { |
37 refCount++; | 38 refCount++; |
38 return refCount; | 39 return refCount; |
39 } | 40 } |
40 /+ | |
41 void createCOMInterfaces () { | |
42 /* Create each of the interfaces that this object implements */ | |
43 supports = new XPCOMObject (new int[] {2, 0, 0}) { | |
44 public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} | |
45 public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} | |
46 public int /*long*/ method2 (int /*long*/[] args) {return Release ();} | |
47 }; | |
48 | |
49 factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { | |
50 public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} | |
51 public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} | |
52 public int /*long*/ method2 (int /*long*/[] args) {return Release ();} | |
53 public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} | |
54 public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} | |
55 }; | |
56 } | |
57 | 41 |
58 void disposeCOMInterfaces () { | 42 extern(System) |
59 if (supports !is null) { | |
60 supports.dispose (); | |
61 supports = null; | |
62 } | |
63 if (factory !is null) { | |
64 factory.dispose (); | |
65 factory = null; | |
66 } | |
67 } | |
68 | |
69 int /*long*/ getAddress () { | |
70 return factory.getAddress (); | |
71 } | |
72 +/ | |
73 nsresult QueryInterface (nsID* riid, void** ppvObject) { | 43 nsresult QueryInterface (nsID* riid, void** ppvObject) { |
74 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; | 44 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; |
75 //nsID guid = new nsID (); | 45 //nsID guid = new nsID (); |
76 //XPCOM.memmove (guid, riid, nsID.sizeof); | 46 //XPCOM.memmove (guid, riid, nsID.sizeof); |
77 | 47 |
87 } | 57 } |
88 | 58 |
89 *ppvObject = null; | 59 *ppvObject = null; |
90 return XPCOM.NS_ERROR_NO_INTERFACE; | 60 return XPCOM.NS_ERROR_NO_INTERFACE; |
91 } | 61 } |
92 | 62 |
63 extern(System) | |
93 nsrefcnt Release () { | 64 nsrefcnt Release () { |
94 refCount--; | 65 refCount--; |
95 //if (refCount is 0) disposeCOMInterfaces (); | 66 //if (refCount is 0) disposeCOMInterfaces (); |
96 return refCount; | 67 return refCount; |
97 } | 68 } |
98 | 69 |
99 /* nsIFactory */ | 70 /* nsIFactory */ |
100 | 71 |
72 extern(System) | |
101 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { | 73 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { |
102 if (result is null) | 74 if (result is null) |
103 return XPCOM.NS_ERROR_INVALID_ARG; | 75 return XPCOM.NS_ERROR_INVALID_ARG; |
104 auto helperAppLauncherDialog = new HelperAppLauncherDialog; | 76 auto helperAppLauncherDialog = new HelperAppLauncherDialog; |
105 nsresult rv = helperAppLauncherDialog.QueryInterface( iid, result ); | 77 nsresult rv = helperAppLauncherDialog.QueryInterface( iid, result ); |
107 *result = null; | 79 *result = null; |
108 delete helperAppLauncherDialog; | 80 delete helperAppLauncherDialog; |
109 } | 81 } |
110 return rv; | 82 return rv; |
111 } | 83 } |
84 | |
85 extern(System) | |
112 nsresult LockFactory (PRBool lock) { | 86 nsresult LockFactory (PRBool lock) { |
113 return XPCOM.NS_OK; | 87 return XPCOM.NS_OK; |
114 } | 88 } |
115 } | 89 } |