Closed Bug 263464 Opened 20 years ago Closed 20 years ago

Reduce XTF QI roundtrips

Categories

(SeaMonkey :: General, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alex, Assigned: alex)

Details

Attachments

(1 file)

Currently, every time an XTF wrapper is QI'ed for an interface on its wrapped
XTF element, we do two QI roundtrips to the wrapped element, once to check if
the element implements the given interface and (if the element implements the
interface) again to wrap the interface in a 'nsXTFInterfaceAggregator' tearoff.
The upcoming patch consolidates the actions of 'AggregatesInterface()' and
'NS_NewXTFInterfaceAggregator' so that we only need one roundtrip to the wrapped
element.
Attached patch patchSplinter Review
Assignee: general → alex
Status: NEW → ASSIGNED
Attachment #161463 - Flags: review?(bryner)
Comment on attachment 161463 [details] [diff] [review]
patch

>--- src/nsXTFInterfaceAggregator.cpp	7 Oct 2004 20:59:50 -0000	1.2
>+++ src/nsXTFInterfaceAggregator.cpp	8 Oct 2004 10:58:26 -0000
>@@ -106,17 +106,17 @@ nsresult
> NS_NewXTFInterfaceAggregator(const nsIID& iid,
>                              nsISupports* inner,
>                              nsISupports* outer,
>-                             nsISupports** aResult){
>+                             void** aResult){
>   NS_PRECONDITION(aResult != nsnull, "null ptr");
>   if (!aResult)
>     return NS_ERROR_NULL_POINTER;
> 
>   nsXTFInterfaceAggregator* result = new nsXTFInterfaceAggregator(iid,inner,outer);
>-  if (! result)
>+  if (!result)
>     return NS_ERROR_OUT_OF_MEMORY;
> 
>   NS_ADDREF(result);
>-  *aResult = result;
>+  *aResult = (void*)result;

This cast shouldn't be necessary.

>--- src/nsXTFElementWrapper.cpp	7 Oct 2004 20:59:50 -0000	1.2
>+++ src/nsXTFElementWrapper.cpp	8 Oct 2004 10:58:09 -0000
>@@ -92,12 +92,14 @@ nsXTFElementWrapper::QueryInterface(REFN
>   else if (NS_SUCCEEDED(rv = nsXTFElementWrapperBase::QueryInterface(aIID, aInstancePtr))) {
>     return rv;
>   }
>-  else if (AggregatesInterface(aIID)) {
>-#ifdef DEBUG
>-//    printf("nsXTFElementWrapper::QueryInterface(): creating aggregation tearoff\n");
>-#endif
>-    return NS_NewXTFInterfaceAggregator(aIID, GetXTFElement(), (nsIContent*)this,
>-                                        (nsISupports**)aInstancePtr);
>+  else {
>+    // try to get get the interface from our wrapped element:
>+    void *innerPtr = nsnull;
>+    QueryInterfaceInner(aIID, &innerPtr);
>+
>+    if (innerPtr)
>+      return NS_NewXTFInterfaceAggregator(aIID, (nsISupports*)innerPtr,

NS_STATIC_CAST

>+                                          (nsIContent*)this, aInstancePtr);

same.

r=me with those changes.
Attachment #161463 - Flags: review?(bryner) → review+
Thanks for the review. Changes applied & checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: