Jacek Caban : mshtml: Store connection point as a list.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 29 08:14:42 CDT 2007


Module: wine
Branch: master
Commit: fc4fd71e011e39e3522f1270c4b72f97a6a3b2ff
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fc4fd71e011e39e3522f1270c4b72f97a6a3b2ff

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jun 29 02:48:50 2007 +0200

mshtml: Store connection point as a list.

---

 dlls/mshtml/conpoint.c       |   36 ++++++++++++++++++------------------
 dlls/mshtml/htmldoc.c        |    5 +++++
 dlls/mshtml/mshtml_private.h |    4 ++++
 3 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index 421a72e..7900ff6 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -184,13 +184,17 @@ static const IConnectionPointVtbl ConnectionPointVtbl =
     ConnectionPoint_EnumConnections
 };
 
-static void ConnectionPoint_Init(HTMLDocument *doc, REFIID riid, ConnectionPoint *cp)
+void ConnectionPoint_Init(ConnectionPoint *cp, HTMLDocument *doc, REFIID riid, ConnectionPoint *prev)
 {
     cp->lpConnectionPointVtbl = &ConnectionPointVtbl;
     cp->doc = doc;
     cp->sinks = NULL;
     cp->sinks_size = 0;
     cp->iid = *riid;
+    cp->next = NULL;
+
+    if(prev)
+        prev->next = cp;
 }
 
 static void ConnectionPoint_Destroy(ConnectionPoint *This)
@@ -238,18 +242,15 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
         REFIID riid, IConnectionPoint **ppCP)
 {
     HTMLDocument *This = CONPTCONT_THIS(iface);
+    ConnectionPoint *iter;
+
+    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
 
     *ppCP = NULL;
 
-    if(IsEqualGUID(&DIID_HTMLDocumentEvents, riid)) {
-        TRACE("(%p)->(DIID_HTMLDocumentEvents %p)\n", This, ppCP);
-        *ppCP = CONPOINT(&This->cp_htmldocevents);
-    }else if(IsEqualGUID(&DIID_HTMLDocumentEvents2, riid)) {
-        TRACE("(%p)->(DIID_HTMLDocumentEvents2 %p)\n", This, ppCP);
-        *ppCP = CONPOINT(&This->cp_htmldocevents2);
-    }else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
-        TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppCP);
-        *ppCP = CONPOINT(&This->cp_propnotif);
+    for(iter = &This->cp_propnotif; iter; iter = iter->next) {
+        if(IsEqualGUID(&iter->iid, riid))
+            *ppCP = CONPOINT(iter);
     }
 
     if(*ppCP) {
@@ -257,7 +258,7 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
         return S_OK;
     }
 
-    FIXME("(%p)->(%s %p) unsupported riid\n", This, debugstr_guid(riid), ppCP);
+    FIXME("unsupported riid %s\n", debugstr_guid(riid));
     return CONNECT_E_NOCONNECTION;
 }
 
@@ -274,15 +275,14 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
 void HTMLDocument_ConnectionPoints_Init(HTMLDocument *This)
 {
     This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
-
-    ConnectionPoint_Init(This, &IID_IPropertyNotifySink, &This->cp_propnotif);
-    ConnectionPoint_Init(This, &DIID_HTMLDocumentEvents, &This->cp_htmldocevents);
-    ConnectionPoint_Init(This, &DIID_HTMLDocumentEvents2, &This->cp_htmldocevents2);
 }
 
 void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument *This)
 {
-    ConnectionPoint_Destroy(&This->cp_propnotif);
-    ConnectionPoint_Destroy(&This->cp_htmldocevents);
-    ConnectionPoint_Destroy(&This->cp_htmldocevents2);
+    ConnectionPoint *iter = &This->cp_propnotif;
+
+    while(iter) {
+        ConnectionPoint_Destroy(iter);
+        iter = iter->next;
+    }
 }
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index a606dac..649a849 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1143,6 +1143,11 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
     HTMLDocument_Hlink_Init(ret);
     HTMLDocument_ConnectionPoints_Init(ret);
 
+    ConnectionPoint_Init(&ret->cp_propnotif, ret, &IID_IPropertyNotifySink, NULL);
+    ConnectionPoint_Init(&ret->cp_htmldocevents, ret, &DIID_HTMLDocumentEvents, &ret->cp_propnotif);
+    ConnectionPoint_Init(&ret->cp_htmldocevents2, ret, &DIID_HTMLDocumentEvents2,
+        &ret->cp_htmldocevents);
+
     ret->nscontainer = NSContainer_Create(ret, NULL);
     ret->window = HTMLWindow_Create(ret);
 
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index b343697..40bf08f 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -84,6 +84,8 @@ struct ConnectionPoint {
     DWORD sinks_size;
 
     IID iid;
+
+    ConnectionPoint *next;
 };
 
 struct HTMLDocument {
@@ -340,6 +342,8 @@ void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
 
 void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument*);
 
+void ConnectionPoint_Init(ConnectionPoint*,HTMLDocument*,REFIID,ConnectionPoint*);
+
 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
 void NSContainer_Release(NSContainer*);
 




More information about the wine-cvs mailing list