1999-05-11 00:46:31 +04:00
|
|
|
// Test06.cpp
|
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
#include "nsPIDOMWindow.h"
|
2002-02-12 07:12:50 +03:00
|
|
|
#include "nsIDocShell.h"
|
2005-02-20 01:42:01 +03:00
|
|
|
#include "nsIBaseWindow.h"
|
1999-05-11 00:46:31 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
NS_DEF_PTR(nsPIDOMWindow);
|
2005-02-20 01:42:01 +03:00
|
|
|
NS_DEF_PTR(nsIBaseWindow);
|
1999-05-11 00:46:31 +04:00
|
|
|
|
2002-02-12 07:12:50 +03:00
|
|
|
/*
|
|
|
|
Windows:
|
|
|
|
nsCOMPtr_optimized 176
|
|
|
|
nsCOMPtr_as_found 181
|
|
|
|
nsCOMPtr_optimized* 182
|
|
|
|
nsCOMPtr02* 184
|
|
|
|
nsCOMPtr02 187
|
|
|
|
nsCOMPtr02* 188
|
|
|
|
nsCOMPtr03 189
|
|
|
|
raw_optimized, nsCOMPtr00 191
|
|
|
|
nsCOMPtr00* 199
|
|
|
|
nsCOMPtr_as_found* 201
|
|
|
|
raw 214
|
|
|
|
|
|
|
|
Macintosh:
|
|
|
|
nsCOMPtr_optimized 300 (1.0000)
|
|
|
|
nsCOMPtr02 320 (1.0667) i.e., 6.67% bigger than nsCOMPtr_optimized
|
|
|
|
nsCOMPtr00 328 (1.0933)
|
|
|
|
raw_optimized, nsCOMPtr03 332 (1.1067)
|
|
|
|
nsCOMPtr_as_found 344 (1.1467)
|
|
|
|
raw 388 (1.2933)
|
|
|
|
|
|
|
|
*/
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
|
|
|
|
void // nsresult
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_raw(nsIDOMWindowInternal* aDOMWindow, nsIBaseWindow** aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m388, w214
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsPIDOMWindow* window = 0;
|
|
|
|
nsresult status = aDOMWindow->QueryInterface(NS_GET_IID(nsPIDOMWindow), (void**)&window);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsIDocShell* docShell = 0;
|
2005-11-29 02:56:44 +03:00
|
|
|
if (window)
|
|
|
|
window->GetDocShell(&docShell);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsIWebShell* rootWebShell = 0;
|
|
|
|
NS_IF_RELEASE(rootWebShell);
|
|
|
|
NS_IF_RELEASE(docShell);
|
2005-11-29 02:56:44 +03:00
|
|
|
NS_IF_RELEASE(window);
|
2002-02-12 07:12:50 +03:00
|
|
|
// return status;
|
|
|
|
}
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
void // nsresult
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_raw_optimized(nsIDOMWindowInternal* aDOMWindow, nsIBaseWindow** aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m332, w191
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
2005-02-20 01:42:01 +03:00
|
|
|
(*aBaseWindow) = 0;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsPIDOMWindow* window;
|
|
|
|
nsresult status = aDOMWindow->QueryInterface(NS_GET_IID(nsPIDOMWindow), (void**)&window);
|
2002-02-12 07:12:50 +03:00
|
|
|
if (NS_SUCCEEDED(status)) {
|
|
|
|
nsIDocShell* docShell = 0;
|
2005-11-29 02:56:44 +03:00
|
|
|
window->GetDocShell(&docShell);
|
2002-02-12 07:12:50 +03:00
|
|
|
if (docShell) {
|
|
|
|
NS_RELEASE(docShell);
|
|
|
|
}
|
2005-11-29 02:56:44 +03:00
|
|
|
NS_RELEASE(window);
|
2002-02-12 07:12:50 +03:00
|
|
|
}
|
|
|
|
// return status;
|
|
|
|
}
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
void
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_nsCOMPtr_as_found(nsIDOMWindowInternal* aDOMWindow, nsCOMPtr<nsIBaseWindow>* aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m344, w181/201
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell;
|
2005-11-29 02:56:44 +03:00
|
|
|
if (window)
|
|
|
|
window->GetDocShell(getter_AddRefs(docShell));
|
2002-02-12 07:12:50 +03:00
|
|
|
}
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
void // nsresult
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_nsCOMPtr00(nsIDOMWindowInternal* aDOMWindow, nsIBaseWindow** aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m328, w191/199
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
|
|
|
nsresult status;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsIDocShell* temp0 = 0;
|
2005-11-29 02:56:44 +03:00
|
|
|
if (window)
|
|
|
|
window->GetDocShell(&temp0);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = dont_AddRef(temp0);
|
2005-02-20 01:42:01 +03:00
|
|
|
(*aBaseWindow) = 0;
|
2002-02-12 07:12:50 +03:00
|
|
|
// return status;
|
|
|
|
}
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
void // nsresult
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_nsCOMPtr_optimized(nsIDOMWindowInternal* aDOMWindow, nsCOMPtr<nsIBaseWindow>* aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m300, w176/182
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
|
|
|
nsresult status;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsIDocShell* temp0 = 0;
|
2005-11-29 02:56:44 +03:00
|
|
|
if (window)
|
|
|
|
window->GetDocShell(&temp0);
|
2005-02-20 01:42:01 +03:00
|
|
|
(*aBaseWindow) = do_QueryInterface(nsnull, &status);
|
2002-02-12 07:12:50 +03:00
|
|
|
// return status;
|
|
|
|
}
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
void // nsresult
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_nsCOMPtr02(nsIDOMWindowInternal* aDOMWindow, nsIBaseWindow** aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m320, w187/184
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
2005-02-20 01:42:01 +03:00
|
|
|
(*aBaseWindow) = 0;
|
2002-02-12 07:12:50 +03:00
|
|
|
nsresult status;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
|
|
|
|
if (window) {
|
2002-02-12 07:12:50 +03:00
|
|
|
nsIDocShell* temp0;
|
2005-11-29 02:56:44 +03:00
|
|
|
window->GetDocShell(&temp0);
|
2002-02-12 07:12:50 +03:00
|
|
|
}
|
|
|
|
// return status;
|
|
|
|
}
|
1999-05-11 00:46:31 +04:00
|
|
|
|
|
|
|
void // nsresult
|
2005-02-20 01:42:01 +03:00
|
|
|
Test06_nsCOMPtr03(nsIDOMWindowInternal* aDOMWindow, nsCOMPtr<nsIBaseWindow>* aBaseWindow)
|
2002-02-12 07:12:50 +03:00
|
|
|
// m332, w189/188
|
|
|
|
{
|
|
|
|
// if (!aDOMWindow)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
2005-02-20 01:42:01 +03:00
|
|
|
(*aBaseWindow) = 0;
|
2002-02-12 07:12:50 +03:00
|
|
|
nsresult status;
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow, &status);
|
|
|
|
if (window) {
|
2002-02-12 07:12:50 +03:00
|
|
|
nsIDocShell* temp0;
|
2005-11-29 02:56:44 +03:00
|
|
|
window->GetDocShell(&temp0);
|
2002-02-12 07:12:50 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = dont_AddRef(temp0);
|
|
|
|
if (docShell) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// return status;
|
|
|
|
}
|