summaryrefslogtreecommitdiffstats
path: root/src/libs/xpcom18a4/xpcom/tests/SizeTest04.cpp
blob: aad4ee68856bc924d218c0d22e14d08c2064f5f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Test04.cpp

#include "nsIDOMNode.h"
#include "nsCOMPtr.h"

#ifdef __MWERKS__
	#pragma exceptions off
#endif

NS_DEF_PTR(nsIDOMNode);

	/*
		Windows:
			nsCOMPtr							 13
			raw										 36

		Macintosh:
			nsCOMPtr							 36 bytes		(1.0000)
			raw										120					(3.3333)	i.e., 333.33% bigger than nsCOMPtr
	*/

class Test04_Raw
	{
		public:
			Test04_Raw();
		 ~Test04_Raw();

			void /*nsresult*/ SetNode( nsIDOMNode* newNode );

		private:
			nsIDOMNode* mNode;
	};

Test04_Raw::Test04_Raw()
		: mNode(0)
	{
		// nothing else to do here
	}

Test04_Raw::~Test04_Raw()
	{
		NS_IF_RELEASE(mNode);
	}

void // nsresult
Test04_Raw::SetNode( nsIDOMNode* newNode )
		// m120, w36
	{
		NS_IF_ADDREF(newNode);
		NS_IF_RELEASE(mNode);
		mNode = newNode;

//		return NS_OK;
	}



class Test04_nsCOMPtr
	{
		public:
			void /*nsresult*/ SetNode( nsIDOMNode* newNode );

		private:
			nsCOMPtr<nsIDOMNode> mNode;
	};

void // nsresult
Test04_nsCOMPtr::SetNode( nsIDOMNode* newNode )
		// m36, w13/13
	{
		mNode = newNode;
	}