Commit 84847d7d authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement Cycle Collection for objects that don't require traversal.

parent 4e0e50e2
......@@ -90,7 +90,6 @@ typedef struct {
typedef struct {
DispatchEx dispex;
IUnknown IUnknown_iface;
LONG ref;
DispatchEx *obj;
func_info_t *info;
} func_disp_t;
......@@ -800,7 +799,7 @@ static HRESULT WINAPI Function_QueryInterface(IUnknown *iface, REFIID riid, void
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IUnknown_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
......@@ -814,7 +813,7 @@ static HRESULT WINAPI Function_QueryInterface(IUnknown *iface, REFIID riid, void
static ULONG WINAPI Function_AddRef(IUnknown *iface)
{
func_disp_t *This = impl_from_IUnknown(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -824,13 +823,10 @@ static ULONG WINAPI Function_AddRef(IUnknown *iface)
static ULONG WINAPI Function_Release(IUnknown *iface)
{
func_disp_t *This = impl_from_IUnknown(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -931,7 +927,6 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info)
ret->IUnknown_iface.lpVtbl = &FunctionUnkVtbl;
init_dispatch(&ret->dispex, &ret->IUnknown_iface, &function_dispex, dispex_compat_mode(obj));
ret->ref = 1;
ret->obj = obj;
ret->info = info;
......
......@@ -6157,7 +6157,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo
if(!doc)
return NULL;
doc->ref = 1;
doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl;
doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl;
doc->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
......
......@@ -339,8 +339,6 @@ typedef struct
{
DispatchEx dispex;
IHTMLFiltersCollection IHTMLFiltersCollection_iface;
LONG ref;
} HTMLFiltersCollection;
static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection *iface)
......@@ -8098,7 +8096,7 @@ static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollectio
}else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
*ppv = &This->IHTMLFiltersCollection_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
......@@ -8113,7 +8111,7 @@ static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollectio
static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
{
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -8123,13 +8121,10 @@ static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
{
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -8279,7 +8274,6 @@ static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFilters
return E_OUTOFMEMORY;
collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
collection->ref = 1;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface,
&HTMLFiltersCollection_dispex, min(compat_mode, COMPAT_MODE_IE8));
......
......@@ -771,7 +771,7 @@ static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFa
*ppv = &This->IHTMLImageElementFactory_iface;
}else if(IsEqualGUID(&IID_IHTMLImageElementFactory, riid)) {
*ppv = &This->IHTMLImageElementFactory_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
......@@ -786,7 +786,7 @@ static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFa
static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *iface)
{
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -796,13 +796,10 @@ static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *ifa
static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *iface)
{
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -991,7 +988,6 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElement
return E_OUTOFMEMORY;
ret->IHTMLImageElementFactory_iface.lpVtbl = &HTMLImageElementFactoryVtbl;
ret->ref = 1;
ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLImageElementFactory_iface,
......
......@@ -449,7 +449,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElement
*ppv = &This->IHTMLOptionElementFactory_iface;
}else if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) {
*ppv = &This->IHTMLOptionElementFactory_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
......@@ -464,7 +464,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElement
static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface)
{
HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -474,13 +474,10 @@ static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *i
static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface)
{
HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -644,7 +641,6 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionEleme
return E_OUTOFMEMORY;
ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl;
ret->ref = 1;
ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLOptionElementFactory_iface,
......
......@@ -39,7 +39,6 @@ enum { MAX_QUOTA = 5000000 };
typedef struct {
DispatchEx dispex;
IHTMLStorage IHTMLStorage_iface;
LONG ref;
unsigned num_props;
BSTR *props;
HTMLInnerWindow *window;
......@@ -370,7 +369,7 @@ static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID rii
*ppv = &This->IHTMLStorage_iface;
}else if(IsEqualGUID(&IID_IHTMLStorage, riid)) {
*ppv = &This->IHTMLStorage_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
......@@ -385,7 +384,7 @@ static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID rii
static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
{
HTMLStorage *This = impl_from_IHTMLStorage(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -395,13 +394,10 @@ static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
{
HTMLStorage *This = impl_from_IHTMLStorage(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -1480,7 +1476,6 @@ HRESULT create_html_storage(HTMLInnerWindow *window, BOOL local, IHTMLStorage **
}
storage->IHTMLStorage_iface.lpVtbl = &HTMLStorageVtbl;
storage->ref = 1;
storage->window = window;
init_dispatch(&storage->dispex, (IUnknown*)&storage->IHTMLStorage_iface, &HTMLStorage_dispex,
......
......@@ -501,8 +501,6 @@ typedef struct {
DispatchEx dispex;
IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
LONG ref;
HTMLInnerWindow *window;
} HTMLOptionElementFactory;
......@@ -510,8 +508,6 @@ typedef struct {
DispatchEx dispex;
IHTMLImageElementFactory IHTMLImageElementFactory_iface;
LONG ref;
HTMLInnerWindow *window;
} HTMLImageElementFactory;
......@@ -519,8 +515,6 @@ typedef struct {
DispatchEx dispex;
IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
LONG ref;
HTMLInnerWindow *window;
} HTMLXMLHttpRequestFactory;
......@@ -533,8 +527,6 @@ typedef struct {
DispatchEx dispex;
IOmHistory IOmHistory_iface;
LONG ref;
HTMLInnerWindow *window;
} OmHistory;
......@@ -969,9 +961,6 @@ struct HTMLDocumentNode {
IInternetHostSecurityManager IInternetHostSecurityManager_iface;
nsIDocumentObserver nsIDocumentObserver_iface;
LONG ref;
ConnectionPointContainer cp_container;
HTMLOuterWindow *outer_window;
HTMLInnerWindow *window;
......
......@@ -1271,8 +1271,6 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca
struct mutation_observer_ctor {
IUnknown IUnknown_iface;
DispatchEx dispex;
LONG ref;
};
static inline struct mutation_observer_ctor *mutation_observer_ctor_from_IUnknown(IUnknown *iface)
......@@ -1293,7 +1291,7 @@ static HRESULT WINAPI mutation_observer_ctor_QueryInterface(IUnknown *iface, REF
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IUnknown_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
......@@ -1308,7 +1306,7 @@ static HRESULT WINAPI mutation_observer_ctor_QueryInterface(IUnknown *iface, REF
static ULONG WINAPI mutation_observer_ctor_AddRef(IUnknown *iface)
{
struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -1318,13 +1316,10 @@ static ULONG WINAPI mutation_observer_ctor_AddRef(IUnknown *iface)
static ULONG WINAPI mutation_observer_ctor_Release(IUnknown *iface)
{
struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -1417,7 +1412,6 @@ HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret
}
obj->IUnknown_iface.lpVtbl = &mutation_observer_ctor_vtbl;
obj->ref = 1;
init_dispatch(&obj->dispex, (IUnknown*)&obj->IUnknown_iface,
&mutation_observer_ctor_dispex, compat_mode);
......
......@@ -1632,7 +1632,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpReque
*ppv = &This->IHTMLXMLHttpRequestFactory_iface;
}else if(IsEqualGUID(&IID_IHTMLXMLHttpRequestFactory, riid)) {
*ppv = &This->IHTMLXMLHttpRequestFactory_iface;
}else if(dispex_query_interface_no_cc(&This->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
......@@ -1647,7 +1647,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpReque
static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory *iface)
{
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
LONG ref = InterlockedIncrement(&This->ref);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
......@@ -1657,13 +1657,10 @@ static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory
static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory *iface)
{
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
LONG ref = InterlockedDecrement(&This->ref);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref;
}
......@@ -1839,7 +1836,6 @@ HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpReq
return E_OUTOFMEMORY;
ret->IHTMLXMLHttpRequestFactory_iface.lpVtbl = &HTMLXMLHttpRequestFactoryVtbl;
ret->ref = 1;
ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLXMLHttpRequestFactory_iface,
......
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