Bug 1865372: Call nsCocoaWindow::DestroyNativeWindow unconditionally in Destroy....
[gecko.git] / xpcom / tests / SizeTest06.cpp
blob11fb352320b53cfb3c30a90ff54134d5e1389402
1 // Test06.cpp
3 #include "nsPIDOMWindow.h"
4 #include "nsIDocShell.h"
5 #include "nsIBaseWindow.h"
6 #include "nsCOMPtr.h"
8 NS_DEF_PTR(nsPIDOMWindow);
9 NS_DEF_PTR(nsIBaseWindow);
12 Windows:
13 nsCOMPtr_optimized 176
14 nsCOMPtr_as_found 181
15 nsCOMPtr_optimized* 182
16 nsCOMPtr02* 184
17 nsCOMPtr02 187
18 nsCOMPtr02* 188
19 nsCOMPtr03 189
20 raw_optimized, nsCOMPtr00 191
21 nsCOMPtr00* 199
22 nsCOMPtr_as_found* 201
23 raw 214
25 Macintosh:
26 nsCOMPtr_optimized 300 (1.0000)
27 nsCOMPtr02 320 (1.0667) i.e., 6.67% bigger than
28 nsCOMPtr_optimized nsCOMPtr00 328 (1.0933) raw_optimized,
29 nsCOMPtr03 332 (1.1067) nsCOMPtr_as_found 344 (1.1467) raw
30 388 (1.2933)
34 void // nsresult
35 Test06_raw(nsIDOMWindow* aDOMWindow, nsIBaseWindow** aBaseWindow)
36 // m388, w214
38 // if (!aDOMWindow)
39 // return NS_ERROR_NULL_POINTER;
40 nsPIDOMWindow* window = 0;
41 nsresult status =
42 aDOMWindow->QueryInterface(NS_GET_IID(nsPIDOMWindow), (void**)&window);
43 nsIDocShell* docShell = 0;
44 if (window) window->GetDocShell(&docShell);
45 nsIWebShell* rootWebShell = 0;
46 NS_IF_RELEASE(rootWebShell);
47 NS_IF_RELEASE(docShell);
48 NS_IF_RELEASE(window);
49 // return status;
52 void // nsresult
53 Test06_raw_optimized(nsIDOMWindow* aDOMWindow, nsIBaseWindow** aBaseWindow)
54 // m332, w191
56 // if (!aDOMWindow)
57 // return NS_ERROR_NULL_POINTER;
58 (*aBaseWindow) = 0;
59 nsPIDOMWindow* window;
60 nsresult status =
61 aDOMWindow->QueryInterface(NS_GET_IID(nsPIDOMWindow), (void**)&window);
62 if (NS_SUCCEEDED(status)) {
63 nsIDocShell* docShell = 0;
64 window->GetDocShell(&docShell);
65 if (docShell) {
66 NS_RELEASE(docShell);
68 NS_RELEASE(window);
70 // return status;
73 void Test06_nsCOMPtr_as_found(nsIDOMWindow* aDOMWindow,
74 nsCOMPtr<nsIBaseWindow>* aBaseWindow)
75 // m344, w181/201
77 // if (!aDOMWindow)
78 // return;
79 nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow);
80 nsCOMPtr<nsIDocShell> docShell;
81 if (window) window->GetDocShell(getter_AddRefs(docShell));
84 void // nsresult
85 Test06_nsCOMPtr00(nsIDOMWindow* aDOMWindow, nsIBaseWindow** aBaseWindow)
86 // m328, w191/199
88 // if (!aDOMWindow)
89 // return NS_ERROR_NULL_POINTER;
90 nsresult status;
91 nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
92 nsIDocShell* temp0 = 0;
93 if (window) window->GetDocShell(&temp0);
94 nsCOMPtr<nsIDocShell> docShell = dont_AddRef(temp0);
95 (*aBaseWindow) = 0;
96 // return status;
99 void // nsresult
100 Test06_nsCOMPtr_optimized(nsIDOMWindow* aDOMWindow,
101 nsCOMPtr<nsIBaseWindow>* aBaseWindow)
102 // m300, w176/182
104 // if (!aDOMWindow)
105 // return NS_ERROR_NULL_POINTER;
106 nsresult status;
107 nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
108 nsIDocShell* temp0 = 0;
109 if (window) window->GetDocShell(&temp0);
110 (*aBaseWindow) = do_QueryInterface(nullptr, &status);
111 // return status;
114 void // nsresult
115 Test06_nsCOMPtr02(nsIDOMWindow* aDOMWindow, nsIBaseWindow** aBaseWindow)
116 // m320, w187/184
118 // if (!aDOMWindow)
119 // return NS_ERROR_NULL_POINTER;
120 (*aBaseWindow) = 0;
121 nsresult status;
122 nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
123 if (window) {
124 nsIDocShell* temp0;
125 window->GetDocShell(&temp0);
127 // return status;
130 void // nsresult
131 Test06_nsCOMPtr03(nsIDOMWindow* aDOMWindow,
132 nsCOMPtr<nsIBaseWindow>* aBaseWindow)
133 // m332, w189/188
135 // if (!aDOMWindow)
136 // return NS_ERROR_NULL_POINTER;
137 (*aBaseWindow) = 0;
138 nsresult status;
139 nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
140 if (window) {
141 nsIDocShell* temp0;
142 window->GetDocShell(&temp0);
143 nsCOMPtr<nsIDocShell> docShell = dont_AddRef(temp0);
144 if (docShell) {
147 // return status;