gecko-dev/xpcom/tests/SizeTest03.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 строки
1.9 KiB
C++
Исходник Обычный вид История

1999-05-11 00:46:31 +04:00
// Test03.cpp
#include "nsINode.h"
1999-05-11 00:46:31 +04:00
#include "nsCOMPtr.h"
#include "nsString.h"
1999-05-11 00:46:31 +04:00
NS_DEF_PTR(nsINode);
1999-05-11 00:46:31 +04:00
/*
Windows:
nsCOMPtr_optimized*
45 raw_optimized
48 nsCOMPtr_optimized
50 nsCOMPtr
54 nsCOMPtr*
59 raw
62
1999-05-11 00:46:31 +04:00
Macintosh:
nsCOMPtr_optimized 112
(1.0000)
raw_optimized 124 bytes
(1.1071) i.e., 10.71% bigger than nsCOMPtr_optimized nsCOMPtr
144 (1.2857)
*/
1999-05-11 00:46:31 +04:00
void // nsresult
Test03_raw(nsINode* aDOMNode, nsString* aResult)
1999-05-11 00:46:31 +04:00
// m140, w62
{
// -- the following code is assumed, but is commented out so we compare only
// the relevent generated code
1999-05-11 00:46:31 +04:00
// if ( !aDOMNode || !aResult )
// return NS_ERROR_NULL_POINTER;
nsINode* parent = 0;
1999-05-11 00:46:31 +04:00
nsresult status = aDOMNode->GetParentNode(&parent);
1999-05-11 00:46:31 +04:00
if (NS_SUCCEEDED(status)) {
parent->GetNodeName(*aResult);
}
1999-05-11 00:46:31 +04:00
NS_IF_RELEASE(parent);
1999-05-11 00:46:31 +04:00
// return status;
}
1999-05-11 00:46:31 +04:00
void // nsresult
Test03_raw_optimized(nsINode* aDOMNode, nsString* aResult)
1999-05-11 00:46:31 +04:00
// m124, w48
{
// if ( !aDOMNode || !aResult )
// return NS_ERROR_NULL_POINTER;
nsINode* parent;
1999-05-11 00:46:31 +04:00
nsresult status = aDOMNode->GetParentNode(&parent);
1999-05-11 00:46:31 +04:00
if (NS_SUCCEEDED(status)) {
parent->GetNodeName(*aResult);
NS_RELEASE(parent);
}
1999-05-11 00:46:31 +04:00
// return status;
}
1999-05-11 00:46:31 +04:00
void // nsresult
Test03_nsCOMPtr(nsINode* aDOMNode, nsString* aResult)
1999-05-11 00:46:31 +04:00
// m144, w54/59
{
// if ( !aDOMNode || !aResult )
// return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsINode> parent;
1999-05-11 00:46:31 +04:00
nsresult status = aDOMNode->GetParentNode(getter_AddRefs(parent));
if (parent) parent->GetNodeName(*aResult);
1999-05-11 00:46:31 +04:00
// return status;
}
1999-05-11 00:46:31 +04:00
void // nsresult
Test03_nsCOMPtr_optimized(nsINode* aDOMNode, nsString* aResult)
1999-05-11 00:46:31 +04:00
// m112, w50/45
{
// if ( !aDOMNode || !aResult )
// return NS_ERROR_NULL_POINTER;
nsINode* temp;
1999-05-11 00:46:31 +04:00
nsresult status = aDOMNode->GetParentNode(&temp);
nsCOMPtr<nsINode> parent(dont_AddRef(temp));
1999-05-11 00:46:31 +04:00
if (parent) parent->GetNodeName(*aResult);
1999-05-11 00:46:31 +04:00
// return status;
}