10 This test file compares the generated code size of similar functions
11 between raw COM interface pointers (|AddRef|ing and |Release|ing by hand) and
14 Function size results were determined by examining dissassembly of the
15 generated code. mXXX is the size of the generated code on the Macintosh. wXXX
16 is the size on Windows. For these tests, all reasonable optimizations were
17 enabled and exceptions were disabled (just as we build for release).
19 The tests in this file explore more complicated functionality: assigning
20 a pointer to be reference counted into a [raw, nsCOMPtr] object using
21 |QueryInterface|; ensuring that it is |AddRef|ed and |Release|d
22 appropriately; calling through the pointer to a function supplied by the
23 underlying COM interface. The tests in this file expand on the tests in
24 "Test01.cpp" by adding |QueryInterface|.
32 nsCOMPtr 120 (1.0000) Raw01
33 128 (1.1429) i.e., 14.29% bigger than nsCOMPtr Raw00
38 Test02_Raw00(nsISupports
* aDOMNode
, nsString
* aResult
)
41 // -- the following code is assumed, but is commented out so we compare only
42 // the relevent generated code
45 // return NS_ERROR_NULL_POINTER;
49 aDOMNode
->QueryInterface(NS_GET_IID(nsINode
), (void**)&node
);
50 if (NS_SUCCEEDED(status
)) {
51 node
->GetNodeName(*aResult
);
60 Test02_Raw01(nsISupports
* aDOMNode
, nsString
* aResult
)
64 // return NS_ERROR_NULL_POINTER;
68 aDOMNode
->QueryInterface(NS_GET_IID(nsINode
), (void**)&node
);
69 if (NS_SUCCEEDED(status
)) {
70 node
->GetNodeName(*aResult
);
78 Test02_nsCOMPtr(nsISupports
* aDOMNode
, nsString
* aResult
)
82 nsCOMPtr
<nsINode
> node
= do_QueryInterface(aDOMNode
, &status
);
84 if (node
) node
->GetNodeName(*aResult
);