VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/tests/SizeTest04.cpp@ 6542

Last change on this file since 6542 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1022 bytes
Line 
1// Test04.cpp
2
3#include "nsIDOMNode.h"
4#include "nsCOMPtr.h"
5
6#ifdef __MWERKS__
7 #pragma exceptions off
8#endif
9
10NS_DEF_PTR(nsIDOMNode);
11
12 /*
13 Windows:
14 nsCOMPtr 13
15 raw 36
16
17 Macintosh:
18 nsCOMPtr 36 bytes (1.0000)
19 raw 120 (3.3333) i.e., 333.33% bigger than nsCOMPtr
20 */
21
22class Test04_Raw
23 {
24 public:
25 Test04_Raw();
26 ~Test04_Raw();
27
28 void /*nsresult*/ SetNode( nsIDOMNode* newNode );
29
30 private:
31 nsIDOMNode* mNode;
32 };
33
34Test04_Raw::Test04_Raw()
35 : mNode(0)
36 {
37 // nothing else to do here
38 }
39
40Test04_Raw::~Test04_Raw()
41 {
42 NS_IF_RELEASE(mNode);
43 }
44
45void // nsresult
46Test04_Raw::SetNode( nsIDOMNode* newNode )
47 // m120, w36
48 {
49 NS_IF_ADDREF(newNode);
50 NS_IF_RELEASE(mNode);
51 mNode = newNode;
52
53// return NS_OK;
54 }
55
56
57
58class Test04_nsCOMPtr
59 {
60 public:
61 void /*nsresult*/ SetNode( nsIDOMNode* newNode );
62
63 private:
64 nsCOMPtr<nsIDOMNode> mNode;
65 };
66
67void // nsresult
68Test04_nsCOMPtr::SetNode( nsIDOMNode* newNode )
69 // m36, w13/13
70 {
71 mNode = newNode;
72 }
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette