Commit fb16633d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Don't use dynamic allocation for connection points.

parent f75b86f0
......@@ -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);
}
......@@ -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;
};
......
......@@ -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);
......
......@@ -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};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment