Commit 0c0cbb5a authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement Cycle Collection for HTMLPerformance.

parent 0afb0b6b
...@@ -2183,8 +2183,6 @@ typedef struct { ...@@ -2183,8 +2183,6 @@ typedef struct {
DispatchEx dispex; DispatchEx dispex;
IHTMLPerformance IHTMLPerformance_iface; IHTMLPerformance IHTMLPerformance_iface;
LONG ref;
IHTMLPerformanceNavigation *navigation; IHTMLPerformanceNavigation *navigation;
HTMLPerformanceTiming *timing; HTMLPerformanceTiming *timing;
} HTMLPerformance; } HTMLPerformance;
...@@ -2204,7 +2202,7 @@ static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, RE ...@@ -2204,7 +2202,7 @@ static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, RE
*ppv = &This->IHTMLPerformance_iface; *ppv = &This->IHTMLPerformance_iface;
}else if(IsEqualGUID(&IID_IHTMLPerformance, riid)) { }else if(IsEqualGUID(&IID_IHTMLPerformance, riid)) {
*ppv = &This->IHTMLPerformance_iface; *ppv = &This->IHTMLPerformance_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; return *ppv ? S_OK : E_NOINTERFACE;
}else { }else {
WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid)); WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
...@@ -2219,7 +2217,7 @@ static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, RE ...@@ -2219,7 +2217,7 @@ static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, RE
static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface) static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface)
{ {
HTMLPerformance *This = impl_from_IHTMLPerformance(iface); HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
LONG ref = InterlockedIncrement(&This->ref); LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
...@@ -2229,13 +2227,10 @@ static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface) ...@@ -2229,13 +2227,10 @@ static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface)
static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface) static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface)
{ {
HTMLPerformance *This = impl_from_IHTMLPerformance(iface); HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
LONG ref = InterlockedDecrement(&This->ref); LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
release_dispex(&This->dispex);
return ref; return ref;
} }
...@@ -2348,6 +2343,15 @@ static inline HTMLPerformance *HTMLPerformance_from_DispatchEx(DispatchEx *iface ...@@ -2348,6 +2343,15 @@ static inline HTMLPerformance *HTMLPerformance_from_DispatchEx(DispatchEx *iface
return CONTAINING_RECORD(iface, HTMLPerformance, dispex); return CONTAINING_RECORD(iface, HTMLPerformance, dispex);
} }
static void HTMLPerformance_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
{
HTMLPerformance *This = HTMLPerformance_from_DispatchEx(dispex);
if(This->navigation)
note_cc_edge((nsISupports*)This->navigation, "navigation", cb);
if(This->timing)
note_cc_edge((nsISupports*)&This->timing->IHTMLPerformanceTiming_iface, "timing", cb);
}
static void HTMLPerformance_unlink(DispatchEx *dispex) static void HTMLPerformance_unlink(DispatchEx *dispex)
{ {
HTMLPerformance *This = HTMLPerformance_from_DispatchEx(dispex); HTMLPerformance *This = HTMLPerformance_from_DispatchEx(dispex);
...@@ -2367,6 +2371,7 @@ static void HTMLPerformance_destructor(DispatchEx *dispex) ...@@ -2367,6 +2371,7 @@ static void HTMLPerformance_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLPerformance_dispex_vtbl = { static const dispex_static_data_vtbl_t HTMLPerformance_dispex_vtbl = {
.destructor = HTMLPerformance_destructor, .destructor = HTMLPerformance_destructor,
.traverse = HTMLPerformance_traverse,
.unlink = HTMLPerformance_unlink .unlink = HTMLPerformance_unlink
}; };
...@@ -2391,7 +2396,6 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) ...@@ -2391,7 +2396,6 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl; performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl;
performance->ref = 1;
init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface, init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface,
&HTMLPerformance_dispex, compat_mode); &HTMLPerformance_dispex, compat_mode);
......
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