VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/tests/SizeTest03.cpp@ 4837

Last change on this file since 4837 was 1, checked in by vboxsync, 54 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1// Test03.cpp
2
3#include "nsIDOMNode.h"
4#include "nsCOMPtr.h"
5#include "nsString.h"
6
7#ifdef __MWERKS__
8 #pragma exceptions off
9#endif
10
11NS_DEF_PTR(nsIDOMNode);
12
13 /*
14 Windows:
15 nsCOMPtr_optimized* 45
16 raw_optimized 48
17 nsCOMPtr_optimized 50
18 nsCOMPtr 54
19 nsCOMPtr* 59
20 raw 62
21
22 Macintosh:
23 nsCOMPtr_optimized 112 (1.0000)
24 raw_optimized 124 bytes (1.1071) i.e., 10.71% bigger than nsCOMPtr_optimized
25 nsCOMPtr 144 (1.2857)
26 */
27
28void // nsresult
29Test03_raw( nsIDOMNode* aDOMNode, nsString* aResult )
30 // m140, w62
31 {
32// -- the following code is assumed, but is commented out so we compare only
33// the relevent generated code
34
35// if ( !aDOMNode || !aResult )
36// return NS_ERROR_NULL_POINTER;
37
38 nsIDOMNode* parent = 0;
39 nsresult status = aDOMNode->GetParentNode(&parent);
40
41 if ( NS_SUCCEEDED(status) )
42 {
43 parent->GetNodeName(*aResult);
44 }
45
46 NS_IF_RELEASE(parent);
47
48// return status;
49 }
50
51
52void // nsresult
53Test03_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
54 // m124, w48
55 {
56// if ( !aDOMNode || !aResult )
57// return NS_ERROR_NULL_POINTER;
58
59 nsIDOMNode* parent;
60 nsresult status = aDOMNode->GetParentNode(&parent);
61
62 if ( NS_SUCCEEDED(status) )
63 {
64 parent->GetNodeName(*aResult);
65 NS_RELEASE(parent);
66 }
67
68// return status;
69 }
70
71
72void // nsresult
73Test03_nsCOMPtr( nsIDOMNode* aDOMNode, nsString* aResult )
74 // m144, w54/59
75 {
76// if ( !aDOMNode || !aResult )
77// return NS_ERROR_NULL_POINTER;
78
79 nsCOMPtr<nsIDOMNode> parent;
80 nsresult status = aDOMNode->GetParentNode( getter_AddRefs(parent) );
81 if ( parent )
82 parent->GetNodeName(*aResult);
83
84// return status;
85 }
86
87void // nsresult
88Test03_nsCOMPtr_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
89 // m112, w50/45
90 {
91// if ( !aDOMNode || !aResult )
92// return NS_ERROR_NULL_POINTER;
93
94 nsIDOMNode* temp;
95 nsresult status = aDOMNode->GetParentNode(&temp);
96 nsCOMPtr<nsIDOMNode> parent( dont_AddRef(temp) );
97 if ( parent )
98 parent->GetNodeName(*aResult);
99
100// return status;
101 }
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use