comxpcomfirefox-osb2g

COM vs. XPCOM the difference between these two


I knew here is a link which discussed a bit about the difference between COM and XPCOM.

What is XPCOM? XPCOM vs COM?

however, I want to know this topic in more detail way. For example, for reference counting and type inference, COM inherited from IUnknown, XPCOM inherited from nsISupport. What's the difference between IUnkown and nsISupoort except naming?

Further, Do these two different components support different threading management or memory management? Topics like this are really interested to me.

Please reply this post if you know any. Thanks


Solution

  • What's the difference between IUnkown and nsISupoort except naming?

    None, really. nsISupoort was specifically designed to be binary-compatible with IUnknown, to make it easier for FireFox to host ActiveX controls, and to be itself exposed as an ActiveX control.

    Do these two different components support different threading management or memory management?

    Yes. XPCOM uses its own memory allocator (nsMemory::Alloc et al), completely independent of COM allocator (CoTaskMemAlloc et al). COM provides an extensive set of threading models as well as marshaling support. XPCOM barely deals with threads at all (see nsIProxyObjectManager), and has no notion of marshaling.

    Warning: this information may very well be obsolete. My familiarity with the state of Mozilla development is current as of 2010 or so.