Bug 1744266 [wpt PR 31876] - WebSockets is its own standard now, a=testonly
[gecko.git] / xpcom / tests / SizeTest03.cpp
blob055db264cd1ef3fdde3dff9d41a7ed0239f0d588
1 // Test03.cpp
3 #include "nsINode.h"
4 #include "nsCOMPtr.h"
5 #include "nsString.h"
7 NS_DEF_PTR(nsINode);
9 /*
10 Windows:
11 nsCOMPtr_optimized*
12 45 raw_optimized
13 48 nsCOMPtr_optimized
14 50 nsCOMPtr
15 54 nsCOMPtr*
16 59 raw
19 Macintosh:
20 nsCOMPtr_optimized 112
21 (1.0000)
22 raw_optimized 124 bytes
23 (1.1071) i.e., 10.71% bigger than nsCOMPtr_optimized nsCOMPtr
24 144 (1.2857)
27 void // nsresult
28 Test03_raw(nsINode* aDOMNode, nsString* aResult)
29 // m140, w62
31 // -- the following code is assumed, but is commented out so we compare only
32 // the relevent generated code
34 // if ( !aDOMNode || !aResult )
35 // return NS_ERROR_NULL_POINTER;
37 nsINode* parent = 0;
38 nsresult status = aDOMNode->GetParentNode(&parent);
40 if (NS_SUCCEEDED(status)) {
41 parent->GetNodeName(*aResult);
44 NS_IF_RELEASE(parent);
46 // return status;
49 void // nsresult
50 Test03_raw_optimized(nsINode* aDOMNode, nsString* aResult)
51 // m124, w48
53 // if ( !aDOMNode || !aResult )
54 // return NS_ERROR_NULL_POINTER;
56 nsINode* parent;
57 nsresult status = aDOMNode->GetParentNode(&parent);
59 if (NS_SUCCEEDED(status)) {
60 parent->GetNodeName(*aResult);
61 NS_RELEASE(parent);
64 // return status;
67 void // nsresult
68 Test03_nsCOMPtr(nsINode* aDOMNode, nsString* aResult)
69 // m144, w54/59
71 // if ( !aDOMNode || !aResult )
72 // return NS_ERROR_NULL_POINTER;
74 nsCOMPtr<nsINode> parent;
75 nsresult status = aDOMNode->GetParentNode(getter_AddRefs(parent));
76 if (parent) parent->GetNodeName(*aResult);
78 // return status;
81 void // nsresult
82 Test03_nsCOMPtr_optimized(nsINode* aDOMNode, nsString* aResult)
83 // m112, w50/45
85 // if ( !aDOMNode || !aResult )
86 // return NS_ERROR_NULL_POINTER;
88 nsINode* temp;
89 nsresult status = aDOMNode->GetParentNode(&temp);
90 nsCOMPtr<nsINode> parent(dont_AddRef(temp));
91 if (parent) parent->GetNodeName(*aResult);
93 // return status;