summaryrefslogtreecommitdiffstats
path: root/xpcom/tests/SizeTest04.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /xpcom/tests/SizeTest04.cpp
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/tests/SizeTest04.cpp')
-rw-r--r--xpcom/tests/SizeTest04.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/xpcom/tests/SizeTest04.cpp b/xpcom/tests/SizeTest04.cpp
new file mode 100644
index 0000000000..c026a1cabf
--- /dev/null
+++ b/xpcom/tests/SizeTest04.cpp
@@ -0,0 +1,61 @@
+// Test04.cpp
+
+#include "nsINode.h"
+#include "nsCOMPtr.h"
+
+NS_DEF_PTR(nsINode);
+
+/*
+ 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(nsINode* newNode);
+
+ private:
+ nsINode* 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(nsINode* newNode)
+// m120, w36
+{
+ NS_IF_ADDREF(newNode);
+ NS_IF_RELEASE(mNode);
+ mNode = newNode;
+
+ // return NS_OK;
+}
+
+class Test04_nsCOMPtr {
+ public:
+ void /*nsresult*/ SetNode(nsINode* newNode);
+
+ private:
+ nsCOMPtr<nsINode> mNode;
+};
+
+void // nsresult
+Test04_nsCOMPtr::SetNode(nsINode* newNode)
+// m36, w13/13
+{
+ mNode = newNode;
+}