3 #include "nsIDOMNode.h"
11 NS_DEF_PTR(nsIDOMNode
);
14 This test file compares the generated code size of similar functions between raw
15 COM interface pointers (|AddRef|ing and |Release|ing by hand) and |nsCOMPtr|s.
17 Function size results were determined by examining dissassembly of the generated code.
18 mXXX is the size of the generated code on the Macintosh. wXXX is the size on Windows.
19 For these tests, all reasonable optimizations were enabled and exceptions were
20 disabled (just as we build for release).
22 The tests in this file explore more complicated functionality: assigning a pointer
23 to be reference counted into a [raw, nsCOMPtr] object using |QueryInterface|;
24 ensuring that it is |AddRef|ed and |Release|d appropriately; calling through the pointer
25 to a function supplied by the underlying COM interface. The tests in this file expand
26 on the tests in "Test01.cpp" by adding |QueryInterface|.
36 Raw01 128 (1.1429) i.e., 14.29% bigger than nsCOMPtr
42 Test02_Raw00( nsISupports
* aDOMNode
, nsString
* aResult
)
45 // -- the following code is assumed, but is commented out so we compare only
46 // the relevent generated code
49 // return NS_ERROR_NULL_POINTER;
52 nsresult status
= aDOMNode
->QueryInterface(NS_GET_IID(nsIDOMNode
), (void**)&node
);
53 if ( NS_SUCCEEDED(status
) )
55 node
->GetNodeName(*aResult
);
64 Test02_Raw01( nsISupports
* aDOMNode
, nsString
* aResult
)
68 // return NS_ERROR_NULL_POINTER;
71 nsresult status
= aDOMNode
->QueryInterface(NS_GET_IID(nsIDOMNode
), (void**)&node
);
72 if ( NS_SUCCEEDED(status
) )
74 node
->GetNodeName(*aResult
);
82 Test02_nsCOMPtr( nsISupports
* aDOMNode
, nsString
* aResult
)
86 nsCOMPtr
<nsIDOMNode
> node
= do_QueryInterface(aDOMNode
, &status
);
89 node
->GetNodeName(*aResult
);