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 nsCOMPtr_optimized
28 nsCOMPtr00 328 (1.0933)
29 raw_optimized, nsCOMPtr03 332 (1.1067)
30 nsCOMPtr_as_found 344 (1.1467)
37 Test06_raw(nsIDOMWindowInternal
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
41 // return NS_ERROR_NULL_POINTER;
42 nsPIDOMWindow
* window
= 0;
43 nsresult status
= aDOMWindow
->QueryInterface(NS_GET_IID(nsPIDOMWindow
), (void**)&window
);
44 nsIDocShell
* docShell
= 0;
46 window
->GetDocShell(&docShell
);
47 nsIWebShell
* rootWebShell
= 0;
48 NS_IF_RELEASE(rootWebShell
);
49 NS_IF_RELEASE(docShell
);
50 NS_IF_RELEASE(window
);
55 Test06_raw_optimized(nsIDOMWindowInternal
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
59 // return NS_ERROR_NULL_POINTER;
61 nsPIDOMWindow
* window
;
62 nsresult status
= aDOMWindow
->QueryInterface(NS_GET_IID(nsPIDOMWindow
), (void**)&window
);
63 if (NS_SUCCEEDED(status
)) {
64 nsIDocShell
* docShell
= 0;
65 window
->GetDocShell(&docShell
);
75 Test06_nsCOMPtr_as_found(nsIDOMWindowInternal
* aDOMWindow
, nsCOMPtr
<nsIBaseWindow
>* aBaseWindow
)
80 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
);
81 nsCOMPtr
<nsIDocShell
> docShell
;
83 window
->GetDocShell(getter_AddRefs(docShell
));
87 Test06_nsCOMPtr00(nsIDOMWindowInternal
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
91 // return NS_ERROR_NULL_POINTER;
93 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
94 nsIDocShell
* temp0
= 0;
96 window
->GetDocShell(&temp0
);
97 nsCOMPtr
<nsIDocShell
> docShell
= dont_AddRef(temp0
);
103 Test06_nsCOMPtr_optimized(nsIDOMWindowInternal
* aDOMWindow
, nsCOMPtr
<nsIBaseWindow
>* aBaseWindow
)
107 // return NS_ERROR_NULL_POINTER;
109 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
110 nsIDocShell
* temp0
= 0;
112 window
->GetDocShell(&temp0
);
113 (*aBaseWindow
) = do_QueryInterface(nsnull
, &status
);
118 Test06_nsCOMPtr02(nsIDOMWindowInternal
* aDOMWindow
, nsIBaseWindow
** aBaseWindow
)
122 // return NS_ERROR_NULL_POINTER;
125 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
128 window
->GetDocShell(&temp0
);
134 Test06_nsCOMPtr03(nsIDOMWindowInternal
* aDOMWindow
, nsCOMPtr
<nsIBaseWindow
>* aBaseWindow
)
138 // return NS_ERROR_NULL_POINTER;
141 nsCOMPtr
<nsPIDOMWindow
> window
= do_QueryInterface(aDOMWindow
, &status
);
144 window
->GetDocShell(&temp0
);
145 nsCOMPtr
<nsIDocShell
> docShell
= dont_AddRef(temp0
);