Bug 1339559 - Identify script that resulted in non-structured-clonable data r=kmag
[gecko.git] / xpcom / tests / SizeTest03.cpp
blobe1593171eca26ffcbc09228607ebeca9c8583e71
1 // Test03.cpp
3 #include "nsIDOMNode.h"
4 #include "nsCOMPtr.h"
5 #include "nsString.h"
7 NS_DEF_PTR(nsIDOMNode);
9 /*
10 Windows:
11 nsCOMPtr_optimized* 45
12 raw_optimized 48
13 nsCOMPtr_optimized 50
14 nsCOMPtr 54
15 nsCOMPtr* 59
16 raw 62
18 Macintosh:
19 nsCOMPtr_optimized 112 (1.0000)
20 raw_optimized 124 bytes (1.1071) i.e., 10.71% bigger than nsCOMPtr_optimized
21 nsCOMPtr 144 (1.2857)
24 void // nsresult
25 Test03_raw( nsIDOMNode* aDOMNode, nsString* aResult )
26 // m140, w62
28 // -- the following code is assumed, but is commented out so we compare only
29 // the relevent generated code
31 // if ( !aDOMNode || !aResult )
32 // return NS_ERROR_NULL_POINTER;
34 nsIDOMNode* parent = 0;
35 nsresult status = aDOMNode->GetParentNode(&parent);
37 if ( NS_SUCCEEDED(status) )
39 parent->GetNodeName(*aResult);
42 NS_IF_RELEASE(parent);
44 // return status;
48 void // nsresult
49 Test03_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
50 // m124, w48
52 // if ( !aDOMNode || !aResult )
53 // return NS_ERROR_NULL_POINTER;
55 nsIDOMNode* parent;
56 nsresult status = aDOMNode->GetParentNode(&parent);
58 if ( NS_SUCCEEDED(status) )
60 parent->GetNodeName(*aResult);
61 NS_RELEASE(parent);
64 // return status;
68 void // nsresult
69 Test03_nsCOMPtr( nsIDOMNode* aDOMNode, nsString* aResult )
70 // m144, w54/59
72 // if ( !aDOMNode || !aResult )
73 // return NS_ERROR_NULL_POINTER;
75 nsCOMPtr<nsIDOMNode> parent;
76 nsresult status = aDOMNode->GetParentNode( getter_AddRefs(parent) );
77 if ( parent )
78 parent->GetNodeName(*aResult);
80 // return status;
83 void // nsresult
84 Test03_nsCOMPtr_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
85 // m112, w50/45
87 // if ( !aDOMNode || !aResult )
88 // return NS_ERROR_NULL_POINTER;
90 nsIDOMNode* temp;
91 nsresult status = aDOMNode->GetParentNode(&temp);
92 nsCOMPtr<nsIDOMNode> parent( dont_AddRef(temp) );
93 if ( parent )
94 parent->GetNodeName(*aResult);
96 // return status;