3 #include "nsPIDOMWindow.h"
4 #include "nsIDocShell.h"
5 #include "nsIBaseWindow.h"
8 NS_DEF_PTR(nsPIDOMWindow
);
9 NS_DEF_PTR(nsIBaseWindow
);
13 nsCOMPtr_optimized 176
15 nsCOMPtr_optimized* 182
20 raw_optimized, nsCOMPtr00 191
22 nsCOMPtr_as_found* 201
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
35 Test06_raw(nsIDOMWindow
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
39 // return NS_ERROR_NULL_POINTER;
40 nsPIDOMWindow
* window
= 0;
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
);
53 Test06_raw_optimized(nsIDOMWindow
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
57 // return NS_ERROR_NULL_POINTER;
59 nsPIDOMWindow
* window
;
61 aDOMWindow
->QueryInterface(NS_GET_IID(nsPIDOMWindow
), (void**)&window
);
62 if (NS_SUCCEEDED(status
)) {
63 nsIDocShell
* docShell
= 0;
64 window
->GetDocShell(&docShell
);
73 void Test06_nsCOMPtr_as_found(nsIDOMWindow
* aDOMWindow
,
74 nsCOMPtr
<nsIBaseWindow
>* aBaseWindow
)
79 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
);
80 nsCOMPtr
<nsIDocShell
> docShell
;
81 if (window
) window
->GetDocShell(getter_AddRefs(docShell
));
85 Test06_nsCOMPtr00(nsIDOMWindow
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
89 // return NS_ERROR_NULL_POINTER;
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
);
100 Test06_nsCOMPtr_optimized(nsIDOMWindow
* aDOMWindow
,
101 nsCOMPtr
<nsIBaseWindow
>* aBaseWindow
)
105 // return NS_ERROR_NULL_POINTER;
107 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
108 nsIDocShell
* temp0
= 0;
109 if (window
) window
->GetDocShell(&temp0
);
110 (*aBaseWindow
) = do_QueryInterface(nullptr, &status
);
115 Test06_nsCOMPtr02(nsIDOMWindow
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
119 // return NS_ERROR_NULL_POINTER;
122 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
125 window
->GetDocShell(&temp0
);
131 Test06_nsCOMPtr03(nsIDOMWindow
* aDOMWindow
,
132 nsCOMPtr
<nsIBaseWindow
>* aBaseWindow
)
136 // return NS_ERROR_NULL_POINTER;
139 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
142 window
->GetDocShell(&temp0
);
143 nsCOMPtr
<nsIDocShell
> docShell
= dont_AddRef(temp0
);