3 #include "nsIDOMNode.h"
7 NS_DEF_PTR(nsIDOMNode
);
10 This test file compares the generated code size of similar functions between raw
11 COM interface pointers (|AddRef|ing and |Release|ing by hand) and |nsCOMPtr|s.
13 Function size results were determined by examining dissassembly of the generated code.
14 mXXX is the size of the generated code on the Macintosh. wXXX is the size on Windows.
15 For these tests, all reasonable optimizations were enabled and exceptions were
16 disabled (just as we build for release).
18 The tests in this file explore more complicated functionality: assigning a pointer
19 to be reference counted into a [raw, nsCOMPtr] object using |QueryInterface|;
20 ensuring that it is |AddRef|ed and |Release|d appropriately; calling through the pointer
21 to a function supplied by the underlying COM interface. The tests in this file expand
22 on the tests in "Test01.cpp" by adding |QueryInterface|.
32 Raw01 128 (1.1429) i.e., 14.29% bigger than nsCOMPtr
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;
48 nsresult status
= aDOMNode
->QueryInterface(NS_GET_IID(nsIDOMNode
), (void**)&node
);
49 if ( NS_SUCCEEDED(status
) )
51 node
->GetNodeName(*aResult
);
60 Test02_Raw01( nsISupports
* aDOMNode
, nsString
* aResult
)
64 // return NS_ERROR_NULL_POINTER;
67 nsresult status
= aDOMNode
->QueryInterface(NS_GET_IID(nsIDOMNode
), (void**)&node
);
68 if ( NS_SUCCEEDED(status
) )
70 node
->GetNodeName(*aResult
);
78 Test02_nsCOMPtr( nsISupports
* aDOMNode
, nsString
* aResult
)
82 nsCOMPtr
<nsIDOMNode
> node
= do_QueryInterface(aDOMNode
, &status
);
85 node
->GetNodeName(*aResult
);