Jacek Caban : mshtml: Don't use dynamic allocation for connection
points.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jun 29 08:14:42 CDT 2007
Module: wine
Branch: master
Commit: fb16633d6f7c6522c3453e3efca0296630198977
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fb16633d6f7c6522c3453e3efca0296630198977
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jun 29 02:47:59 2007 +0200
mshtml: Don't use dynamic allocation for connection points.
---
dlls/mshtml/conpoint.c | 50 ++++++++++++-----------------------------
dlls/mshtml/mshtml_private.h | 21 +++++++++++++++--
dlls/mshtml/persist.c | 2 +-
dlls/mshtml/task.c | 6 ++--
4 files changed, 37 insertions(+), 42 deletions(-)
diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index 9077baf..421a72e 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -36,21 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define CONPOINT(x) ((IConnectionPoint*) &(x)->lpConnectionPointVtbl);
-struct ConnectionPoint {
- const IConnectionPointVtbl *lpConnectionPointVtbl;
-
- HTMLDocument *doc;
-
- union {
- IUnknown *unk;
- IDispatch *disp;
- IPropertyNotifySink *propnotif;
- } *sinks;
- DWORD sinks_size;
-
- IID iid;
-};
-
void call_property_onchanged(ConnectionPoint *This, DISPID dispid)
{
DWORD i;
@@ -199,17 +184,13 @@ static const IConnectionPointVtbl ConnectionPointVtbl =
ConnectionPoint_EnumConnections
};
-static void ConnectionPoint_Create(HTMLDocument *doc, REFIID riid, ConnectionPoint **cp)
+static void ConnectionPoint_Init(HTMLDocument *doc, REFIID riid, ConnectionPoint *cp)
{
- ConnectionPoint *ret = mshtml_alloc(sizeof(ConnectionPoint));
-
- ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
- ret->doc = doc;
- ret->sinks = NULL;
- ret->sinks_size = 0;
- memcpy(&ret->iid, riid, sizeof(IID));
-
- *cp = ret;
+ cp->lpConnectionPointVtbl = &ConnectionPointVtbl;
+ cp->doc = doc;
+ cp->sinks = NULL;
+ cp->sinks_size = 0;
+ cp->iid = *riid;
}
static void ConnectionPoint_Destroy(ConnectionPoint *This)
@@ -222,7 +203,6 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
}
mshtml_free(This->sinks);
- mshtml_free(This);
}
#define CONPTCONT_THIS(iface) DEFINE_THIS(HTMLDocument, ConnectionPointContainer, iface)
@@ -263,13 +243,13 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
if(IsEqualGUID(&DIID_HTMLDocumentEvents, riid)) {
TRACE("(%p)->(DIID_HTMLDocumentEvents %p)\n", This, ppCP);
- *ppCP = CONPOINT(This->cp_htmldocevents);
+ *ppCP = CONPOINT(&This->cp_htmldocevents);
}else if(IsEqualGUID(&DIID_HTMLDocumentEvents2, riid)) {
TRACE("(%p)->(DIID_HTMLDocumentEvents2 %p)\n", This, ppCP);
- *ppCP = CONPOINT(This->cp_htmldocevents2);
+ *ppCP = CONPOINT(&This->cp_htmldocevents2);
}else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppCP);
- *ppCP = CONPOINT(This->cp_propnotif);
+ *ppCP = CONPOINT(&This->cp_propnotif);
}
if(*ppCP) {
@@ -295,14 +275,14 @@ void HTMLDocument_ConnectionPoints_Init(HTMLDocument *This)
{
This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
- ConnectionPoint_Create(This, &IID_IPropertyNotifySink, &This->cp_propnotif);
- ConnectionPoint_Create(This, &DIID_HTMLDocumentEvents, &This->cp_htmldocevents);
- ConnectionPoint_Create(This, &DIID_HTMLDocumentEvents2, &This->cp_htmldocevents2);
+ 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_Destroy(&This->cp_propnotif);
+ ConnectionPoint_Destroy(&This->cp_htmldocevents);
+ ConnectionPoint_Destroy(&This->cp_htmldocevents2);
}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 1b8b02f..b343697 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -71,6 +71,21 @@ typedef enum {
EDITMODE
} USERMODE;
+struct ConnectionPoint {
+ const IConnectionPointVtbl *lpConnectionPointVtbl;
+
+ HTMLDocument *doc;
+
+ union {
+ IUnknown *unk;
+ IDispatch *disp;
+ IPropertyNotifySink *propnotif;
+ } *sinks;
+ DWORD sinks_size;
+
+ IID iid;
+};
+
struct HTMLDocument {
const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
@@ -120,9 +135,9 @@ struct HTMLDocument {
DWORD update;
- ConnectionPoint *cp_htmldocevents;
- ConnectionPoint *cp_htmldocevents2;
- ConnectionPoint *cp_propnotif;
+ ConnectionPoint cp_htmldocevents;
+ ConnectionPoint cp_htmldocevents2;
+ ConnectionPoint cp_propnotif;
HTMLDOMNode *nodes;
};
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c
index 58ca422..3b606d6 100644
--- a/dlls/mshtml/persist.c
+++ b/dlls/mshtml/persist.c
@@ -177,7 +177,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
}
This->readystate = READYSTATE_LOADING;
- call_property_onchanged(This->cp_propnotif, DISPID_READYSTATE);
+ call_property_onchanged(&This->cp_propnotif, DISPID_READYSTATE);
update_doc(This, UPDATE_TITLE);
HTMLDocument_LockContainer(This, TRUE);
diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c
index 540c969..5204a89 100644
--- a/dlls/mshtml/task.c
+++ b/dlls/mshtml/task.c
@@ -135,10 +135,10 @@ static void set_parsecomplete(HTMLDocument *doc)
if(doc->usermode == EDITMODE)
init_editor(doc);
- call_property_onchanged(doc->cp_propnotif, 1005);
+ call_property_onchanged(&doc->cp_propnotif, 1005);
doc->readystate = READYSTATE_INTERACTIVE;
- call_property_onchanged(doc->cp_propnotif, DISPID_READYSTATE);
+ call_property_onchanged(&doc->cp_propnotif, DISPID_READYSTATE);
if(doc->client)
IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
@@ -163,7 +163,7 @@ static void set_parsecomplete(HTMLDocument *doc)
}
doc->readystate = READYSTATE_COMPLETE;
- call_property_onchanged(doc->cp_propnotif, DISPID_READYSTATE);
+ call_property_onchanged(&doc->cp_propnotif, DISPID_READYSTATE);
if(doc->frame) {
static const WCHAR wszDone[] = {'D','o','n','e',0};
More information about the wine-cvs
mailing list