winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
712 discussions
Start a n
N
ew thread
Jacek Caban : ole32: Use proper allocators for storing source in ErrorInfoImpl.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 4843f031f987ad4ac5bf21a64d90d3ffd5a0e8ca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4843f031f987ad4ac5bf21a64…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jul 19 11:49:09 2012 +0200 ole32: Use proper allocators for storing source in ErrorInfoImpl. --- dlls/ole32/errorinfo.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-) diff --git a/dlls/ole32/errorinfo.c b/dlls/ole32/errorinfo.c index 055d6a5..8dbfff9 100644 --- a/dlls/ole32/errorinfo.c +++ b/dlls/ole32/errorinfo.c @@ -41,6 +41,32 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); +static inline void *heap_alloc(size_t len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} + +static inline WCHAR *heap_strdupW(const WCHAR *str) +{ + WCHAR *ret = NULL; + + if(str) { + size_t size; + + size = (strlenW(str)+1)*sizeof(WCHAR); + ret = heap_alloc(size); + if(ret) + memcpy(ret, str, size); + } + + return ret; +} + /* this code is from SysAllocStringLen (ole2disp.c in oleaut32) */ static BSTR ERRORINFO_SysAllocString(const OLECHAR* in) { @@ -129,7 +155,7 @@ typedef struct ErrorInfoImpl LONG ref; GUID m_Guid; - BSTR bstrSource; + WCHAR *source; BSTR bstrDescription; BSTR bstrHelpFile; DWORD m_dwHelpContext; @@ -203,7 +229,7 @@ static ULONG WINAPI IErrorInfoImpl_Release( { TRACE("-- destroying IErrorInfo(%p)\n",This); - ERRORINFO_SysFreeString(This->bstrSource); + heap_free(This->source); ERRORINFO_SysFreeString(This->bstrDescription); ERRORINFO_SysFreeString(This->bstrHelpFile); HeapFree(GetProcessHeap(),0,This); @@ -231,7 +257,7 @@ static HRESULT WINAPI IErrorInfoImpl_GetSource( TRACE("(%p)->(pBstrSource=%p)\n",This,pBstrSource); if (pBstrSource == NULL) return E_INVALIDARG; - *pBstrSource = ERRORINFO_SysAllocString(This->bstrSource); + *pBstrSource = SysAllocString(This->source); return S_OK; } @@ -329,9 +355,9 @@ static HRESULT WINAPI ICreateErrorInfoImpl_SetSource( { ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface); TRACE("(%p): %s\n",This, debugstr_w(szSource)); - if (This->bstrSource != NULL) - ERRORINFO_SysFreeString(This->bstrSource); - This->bstrSource = ERRORINFO_SysAllocString(szSource); + + heap_free(This->source); + This->source = heap_strdupW(szSource); return S_OK; } @@ -423,7 +449,7 @@ static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = static IErrorInfo* IErrorInfoImpl_Constructor(void) { - ErrorInfoImpl *This = HeapAlloc(GetProcessHeap(), 0, sizeof(ErrorInfoImpl)); + ErrorInfoImpl *This = heap_alloc(sizeof(ErrorInfoImpl)); if (!This) return NULL; @@ -431,7 +457,7 @@ static IErrorInfo* IErrorInfoImpl_Constructor(void) This->ICreateErrorInfo_iface.lpVtbl = &CreateErrorInfoVtbl; This->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl; This->ref = 1; - This->bstrSource = NULL; + This->source = NULL; This->bstrDescription = NULL; This->bstrHelpFile = NULL; This->m_dwHelpContext = 0;
1
0
0
0
Jacek Caban : mshtml: Store MSHTML node reference in Gecko node object and get rid of all node list in document object .
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 12f1fbb7a4f0c6e741275e69eb9a12c4b32da79d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=12f1fbb7a4f0c6e741275e69e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jul 19 11:29:34 2012 +0200 mshtml: Store MSHTML node reference in Gecko node object and get rid of all node list in document object. --- dlls/mshtml/htmldoc.c | 1 - dlls/mshtml/htmlnode.c | 65 ++++++++++++++++++++--------------------- dlls/mshtml/mshtml_private.h | 4 -- 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index d78767c..f9e11ce 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2080,7 +2080,6 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) detach_selection(This); detach_ranges(This); - release_nodes(This); while(!list_empty(&This->plugin_hosts)) detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry)); diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index a9e5d3f..7fcff17 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -17,6 +17,7 @@ */ #include <stdarg.h> +#include <assert.h> #define COBJMACROS @@ -1028,6 +1029,8 @@ void HTMLDOMNode_destructor(HTMLDOMNode *This) { if(This->nsnode) nsIDOMNode_Release(This->nsnode); + if(This->doc && &This->doc->node != This) + htmldoc_release(&This->doc->basedoc); if(This->event_target) release_event_target(This->event_target); } @@ -1045,17 +1048,23 @@ static const NodeImplVtbl HTMLDOMNodeImplVtbl = { void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode) { + nsresult nsres; + node->IHTMLDOMNode_iface.lpVtbl = &HTMLDOMNodeVtbl; node->IHTMLDOMNode2_iface.lpVtbl = &HTMLDOMNode2Vtbl; - ccref_init(&node->ccref, &doc->node != node ? 2 : 1); + + ccref_init(&node->ccref, 1); + + if(&doc->node != node) + htmldoc_addref(&doc->basedoc); node->doc = doc; if(nsnode) nsIDOMNode_AddRef(nsnode); node->nsnode = nsnode; - node->next = doc->nodes; - doc->nodes = node; + nsres = nsIDOMNode_SetMshtmlNode(nsnode, (nsISupports*)&node->IHTMLDOMNode_iface); + assert(nsres == NS_OK); } static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNode **ret) @@ -1123,6 +1132,8 @@ static nsresult NSAPI HTMLDOMNode_traverse(void *ccp, void *p, nsCycleCollection if(This->nsnode) note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb); + if(This->doc && &This->doc->node != This) + note_cc_edge((nsISupports*)&This->doc->node.IHTMLDOMNode_iface, "This->doc", cb); dispex_traverse(&This->dispex, cb); if(This->vtbl->traverse) @@ -1148,6 +1159,14 @@ static nsresult NSAPI HTMLDOMNode_unlink(void *p) nsIDOMNode_Release(nsnode); } + if(This->doc && &This->doc->node != This) { + HTMLDocument *doc = &This->doc->basedoc; + This->doc = NULL; + htmldoc_release(doc); + }else { + This->doc = NULL; + } + return NS_OK; } @@ -1162,43 +1181,23 @@ void init_node_cc(void) ccp_init(&node_ccp, &node_ccp_callback); } -/* - * FIXME - * List looks really ugly here. We should use a better data structure or - * (better) find a way to store HTMLDOMelement pointer in nsIDOMNode. - */ - HRESULT get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create, HTMLDOMNode **ret) { - HTMLDOMNode *iter = This->nodes; + nsISupports *unk = NULL; + nsresult nsres; - while(iter) { - if(iter->nsnode == nsnode) - break; - iter = iter->next; + nsres = nsIDOMNode_GetMshtmlNode(nsnode, &unk); + assert(nsres == NS_OK); + + if(unk) { + *ret = get_node_obj(This, (IUnknown*)unk); + return NS_OK; } - if(iter || !create) { - if(iter) - IHTMLDOMNode_AddRef(&iter->IHTMLDOMNode_iface); - *ret = iter; + if(!create) { + *ret = NULL; return S_OK; } return create_node(This, nsnode, ret); } - -void release_nodes(HTMLDocumentNode *This) -{ - HTMLDOMNode *iter, *next; - - if(!This->nodes) - return; - - for(iter = This->nodes; iter; iter = next) { - next = iter->next; - iter->doc = NULL; - if(&This->node != iter) - IHTMLDOMNode_Release(&iter->IHTMLDOMNode_iface); - } -} diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index af165bf..f006176 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -603,8 +603,6 @@ struct HTMLDOMNode { HTMLDocumentNode *doc; event_target_t *event_target; ConnectionPointContainer *cp_container; - - HTMLDOMNode *next; }; static inline void node_addref(HTMLDOMNode *node) @@ -673,7 +671,6 @@ struct HTMLDocumentNode { LONG ref; nsIDOMHTMLDocument *nsdoc; - HTMLDOMNode *nodes; BOOL content_ready; event_target_t *body_event_target; @@ -881,7 +878,6 @@ HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN; void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN; HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN; -void release_nodes(HTMLDocumentNode*) DECLSPEC_HIDDEN; HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1
0
0
0
Jacek Caban : mshtml: Make nsIDOMHTMLDocument reference cycle collectable.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 94060b99c939413d9425f4c196e36066644421b4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=94060b99c939413d9425f4c19…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jul 19 11:29:13 2012 +0200 mshtml: Make nsIDOMHTMLDocument reference cycle collectable. --- dlls/mshtml/htmldoc.c | 43 ++++++++++++++++++++++++++++++++++++++--- dlls/mshtml/htmlnode.c | 6 +++++ dlls/mshtml/mshtml_private.h | 2 + 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 8d5330e..d78767c 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2085,8 +2085,10 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) while(!list_empty(&This->plugin_hosts)) detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry)); - if(This->nsdoc) + if(This->nsdoc) { release_document_mutation(This); + nsIDOMHTMLDocument_Release(This->nsdoc); + } heap_free(This->event_vector); destroy_htmldoc(&This->basedoc); @@ -2099,10 +2101,44 @@ static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HT return E_NOTIMPL; } +static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb) +{ + HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface); + + if(This->nsdoc) + note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb); +} + +static void HTMLDocumentNode_unlink(HTMLDOMNode *iface) +{ + HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface); + + if(This->nsdoc) { + nsIDOMHTMLDocument *nsdoc = This->nsdoc; + + release_document_mutation(This); + This->nsdoc = NULL; + nsIDOMHTMLDocument_Release(nsdoc); + } +} + static const NodeImplVtbl HTMLDocumentNodeImplVtbl = { HTMLDocumentNode_QI, HTMLDocumentNode_destructor, - HTMLDocumentNode_clone + HTMLDocumentNode_clone, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + HTMLDocumentNode_traverse, + HTMLDocumentNode_unlink }; static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) @@ -2236,8 +2272,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc); - /* No AddRef, share the reference with nsnode */ - assert((nsIDOMNode*)nsdoc == doc->node.nsnode); + nsIDOMHTMLDocument_AddRef(nsdoc); doc->nsdoc = nsdoc; init_document_mutation(doc); diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 2afcb23..a9e5d3f 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -1125,6 +1125,9 @@ static nsresult NSAPI HTMLDOMNode_traverse(void *ccp, void *p, nsCycleCollection note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb); dispex_traverse(&This->dispex, cb); + if(This->vtbl->traverse) + This->vtbl->traverse(This, cb); + return NS_OK; } @@ -1134,6 +1137,9 @@ static nsresult NSAPI HTMLDOMNode_unlink(void *p) TRACE("%p\n", This); + if(This->vtbl->unlink) + This->vtbl->unlink(This); + dispex_unlink(&This->dispex); if(This->nsnode) { diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 803d214..af165bf 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -587,6 +587,8 @@ typedef struct { HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*); HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*bind_to_tree)(HTMLDOMNode*); + void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*); + void (*unlink)(HTMLDOMNode*); } NodeImplVtbl; struct HTMLDOMNode {
1
0
0
0
Jacek Caban : mshtml: Make node object' s dynamic IDispatchEx-based properties cycle collectable.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: e9cc7676fa239264598570f1cd800475d61bca36 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e9cc7676fa239264598570f1c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jul 19 11:28:54 2012 +0200 mshtml: Make node object's dynamic IDispatchEx-based properties cycle collectable. --- dlls/mshtml/dispex.c | 32 ++++++++++++++++++++++++++++++++ dlls/mshtml/htmlnode.c | 3 +++ dlls/mshtml/mshtml_private.h | 2 ++ 3 files changed, 37 insertions(+), 0 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index bbe6098..b2024d4 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1377,6 +1377,38 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) return TRUE; } +void dispex_traverse(DispatchEx *This, nsCycleCollectionTraversalCallback *cb) +{ + dynamic_prop_t *prop; + + if(!This->dynamic_data) + return; + + for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { + if(V_VT(&prop->var) == VT_DISPATCH) + note_cc_edge((nsISupports*)V_DISPATCH(&prop->var), "dispex_data", cb); + } + + /* FIXME: Traverse func_disps */ +} + +void dispex_unlink(DispatchEx *This) +{ + dynamic_prop_t *prop; + + if(!This->dynamic_data) + return; + + for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { + if(V_VT(&prop->var) == VT_DISPATCH) { + V_VT(&prop->var) = VT_EMPTY; + IDispatch_Release(V_DISPATCH(&prop->var)); + }else { + VariantClear(&prop->var); + } + } +} + void release_dispex(DispatchEx *This) { dynamic_prop_t *prop; diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index f33df64..2afcb23 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -1123,6 +1123,7 @@ static nsresult NSAPI HTMLDOMNode_traverse(void *ccp, void *p, nsCycleCollection if(This->nsnode) note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb); + dispex_traverse(&This->dispex, cb); return NS_OK; } @@ -1133,6 +1134,8 @@ static nsresult NSAPI HTMLDOMNode_unlink(void *p) TRACE("%p\n", This); + dispex_unlink(&This->dispex); + if(This->nsnode) { nsIDOMNode *nsnode = This->nsnode; This->nsnode = NULL; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index efa6f52..803d214 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -258,6 +258,8 @@ HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_H HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN; HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN; +void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN; +void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN; void release_typelib(void) DECLSPEC_HIDDEN; HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
1
0
0
0
Jacek Caban : mshtml: Make node object cycle collector aware.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 97ff991f463ef129340c0ec917d8cbf70e57856e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=97ff991f463ef129340c0ec91…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jul 19 11:28:35 2012 +0200 mshtml: Make node object cycle collector aware. --- dlls/mshtml/htmlnode.c | 65 ++++++++++++++++++++++++++++++++++++++---- dlls/mshtml/mshtml_private.h | 30 ++++++++++++++++++- dlls/mshtml/nsembed.c | 17 +++++++++++ dlls/mshtml/nsiface.idl | 7 ++++ 4 files changed, 112 insertions(+), 7 deletions(-) diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 3951494..f33df64 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -312,7 +312,7 @@ static HRESULT WINAPI HTMLDOMNode_QueryInterface(IHTMLDOMNode *iface, static ULONG WINAPI HTMLDOMNode_AddRef(IHTMLDOMNode *iface) { HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = ccref_incr(&This->ccref, (nsISupports*)&This->IHTMLDOMNode_iface); TRACE("(%p) ref=%d\n", This, ref); @@ -322,7 +322,7 @@ static ULONG WINAPI HTMLDOMNode_AddRef(IHTMLDOMNode *iface) static ULONG WINAPI HTMLDOMNode_Release(IHTMLDOMNode *iface) { HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = ccref_decr(&This->ccref, (nsISupports*)&This->IHTMLDOMNode_iface); TRACE("(%p) ref=%d\n", This, ref); @@ -977,6 +977,8 @@ static const IHTMLDOMNode2Vtbl HTMLDOMNode2Vtbl = { HTMLDOMNode2_get_ownerDocument }; +static nsXPCOMCycleCollectionParticipant node_ccp; + HRESULT HTMLDOMNode_QI(HTMLDOMNode *This, REFIID riid, void **ppv) { *ppv = NULL; @@ -1001,6 +1003,14 @@ HRESULT HTMLDOMNode_QI(HTMLDOMNode *This, REFIID riid, void **ppv) }else if(IsEqualGUID(&IID_IHTMLDOMNode2, riid)) { TRACE("(%p)->(IID_IHTMLDOMNode2 %p)\n", This, ppv); *ppv = &This->IHTMLDOMNode2_iface; + }else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid)) { + TRACE("(%p)->(IID_nsXPCOMCycleCollectionParticipant %p)\n", This, ppv); + *ppv = &node_ccp; + return NS_OK; + }else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid)) { + TRACE("(%p)->(IID_nsCycleCollectionISupports %p)\n", This, ppv); + *ppv = &This->IHTMLDOMNode_iface; + return NS_OK; }else if(dispex_query_interface(&This->dispex, riid, ppv)) { return *ppv ? S_OK : E_NOINTERFACE; } @@ -1037,12 +1047,9 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno { node->IHTMLDOMNode_iface.lpVtbl = &HTMLDOMNodeVtbl; node->IHTMLDOMNode2_iface.lpVtbl = &HTMLDOMNode2Vtbl; - node->ref = 2; + ccref_init(&node->ccref, &doc->node != node ? 2 : 1); node->doc = doc; - if(&doc->node != node) - node->ref++; /* one extra for list entry reference */ - if(nsnode) nsIDOMNode_AddRef(nsnode); node->nsnode = nsnode; @@ -1100,6 +1107,52 @@ static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNod return S_OK; } +static void NSAPI HTMLDOMNode_unmark_if_purple(void *p) +{ + HTMLDOMNode *This = impl_from_IHTMLDOMNode(p); + ccref_unmark_if_purple(&This->ccref); +} + +static nsresult NSAPI HTMLDOMNode_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) +{ + HTMLDOMNode *This = impl_from_IHTMLDOMNode(p); + + TRACE("%p\n", This); + + describe_cc_node(&This->ccref, sizeof(*This), "HTMLDOMNode", cb); + + if(This->nsnode) + note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb); + + return NS_OK; +} + +static nsresult NSAPI HTMLDOMNode_unlink(void *p) +{ + HTMLDOMNode *This = impl_from_IHTMLDOMNode(p); + + TRACE("%p\n", This); + + if(This->nsnode) { + nsIDOMNode *nsnode = This->nsnode; + This->nsnode = NULL; + nsIDOMNode_Release(nsnode); + } + + return NS_OK; +} + +void init_node_cc(void) +{ + static const CCObjCallback node_ccp_callback = { + HTMLDOMNode_unmark_if_purple, + HTMLDOMNode_traverse, + HTMLDOMNode_unlink + }; + + ccp_init(&node_ccp, &node_ccp_callback); +} + /* * FIXME * List looks really ugly here. We should use a better data structure or diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index e2d347c..efa6f52 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -225,6 +225,32 @@ struct DispatchEx { dispex_dynamic_data_t *dynamic_data; }; +typedef struct { + void *x; +} nsCycleCollectingAutoRefCnt; + +typedef struct { + void *x[3]; +} nsXPCOMCycleCollectionParticipant; + +typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback; + +typedef struct { + void (NSAPI *unmark_if_purple)(void*); + nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*); + nsresult (NSAPI *unlink)(void*); +} CCObjCallback; + +DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9); + +nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*); +nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*); +void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt); +void (__cdecl *ccref_unmark_if_purple)(nsCycleCollectingAutoRefCnt*); +void (__cdecl *ccp_init)(nsXPCOMCycleCollectionParticipant*,const CCObjCallback*); +void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,size_t,const char*,nsCycleCollectionTraversalCallback*); +void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*); + void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN; void release_dispex(DispatchEx*) DECLSPEC_HIDDEN; BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN; @@ -567,7 +593,7 @@ struct HTMLDOMNode { IHTMLDOMNode2 IHTMLDOMNode2_iface; const NodeImplVtbl *vtbl; - LONG ref; + nsCycleCollectingAutoRefCnt ccref; nsIDOMNode *nsnode; HTMLDocumentNode *doc; @@ -723,6 +749,8 @@ void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN; void release_nsio(void) DECLSPEC_HIDDEN; BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN; +void init_node_cc(void); + HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN; BOOL compare_ignoring_frag(IUri*,IUri*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 70bdfa7..8ff7ad2 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -347,6 +347,21 @@ static BOOL load_xul(const PRUnichar *gre_path) #undef NS_DLSYM +#define NS_DLSYM(func) \ + func = (void *)GetProcAddress(xul_handle, #func); \ + if(!func) \ + ERR("Could not GetProcAddress(" #func ") failed\n") + + NS_DLSYM(ccref_incr); + NS_DLSYM(ccref_decr); + NS_DLSYM(ccref_init); + NS_DLSYM(ccref_unmark_if_purple); + NS_DLSYM(ccp_init); + NS_DLSYM(describe_cc_node); + NS_DLSYM(note_cc_edge); + +#undef NS_DLSYM + return TRUE; } @@ -561,6 +576,8 @@ static BOOL init_xpcom(const PRUnichar *gre_path) nsIComponentRegistrar_Release(registrar); } + init_node_cc(); + return TRUE; } diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 04d77d5..13748b9 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -3450,6 +3450,13 @@ interface nsIDocumentObserver : nsIMutationObserver [ object, + uuid(c61eac14-5f7a-4481-965e-7eaa6effa85f), + local +] +interface nsCycleCollectionISupports {} + +[ + object, uuid(3682dd99-8560-44f4-9b8f-ccce9d7b96fb), local ]
1
0
0
0
Michael Stefaniuc : dsound: Get rid of the DSOUND_QueryInterface() helper.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 4c7e608d5ceb1ac51d0a6e7456205d0f7f85743b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4c7e608d5ceb1ac51d0a6e745…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Jul 19 02:07:23 2012 +0200 dsound: Get rid of the DSOUND_QueryInterface() helper. --- dlls/dsound/dsound.c | 52 +++++++++++++++++++------------------------------ 1 files changed, 20 insertions(+), 32 deletions(-) diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index 3d74821..ad41f59 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -116,37 +116,6 @@ static void _dump_DSBCAPS(DWORD xmask) { TRACE("%s ",flags[i].name); } -/******************************************************************************* - * IDirectSoundImpl_DirectSound - */ -static HRESULT DSOUND_QueryInterface( - LPDIRECTSOUND8 iface, - REFIID riid, - LPVOID * ppobj) -{ - IDirectSoundImpl *This = (IDirectSoundImpl *)iface; - TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); - - if (ppobj == NULL) { - WARN("invalid parameter\n"); - return E_INVALIDARG; - } - - if (IsEqualIID(riid, &IID_IUnknown)) { - IUnknown_AddRef(&This->IUnknown_iface); - *ppobj = &This->IUnknown_iface; - return S_OK; - } else if (IsEqualIID(riid, &IID_IDirectSound) || (This->has_ds8 && IsEqualIID(riid, &IID_IDirectSound8))) { - IDirectSound8_AddRef(&This->IDirectSound8_iface); - *ppobj = &This->IDirectSound8_iface; - return S_OK; - } - - *ppobj = NULL; - WARN("Unknown IID %s\n",debugstr_guid(riid)); - return E_NOINTERFACE; -} - static void directsound_destroy(IDirectSoundImpl *This) { if (This->device) @@ -166,8 +135,27 @@ static inline IDirectSoundImpl *impl_from_IUnknown(IUnknown *iface) static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) { IDirectSoundImpl *This = impl_from_IUnknown(iface); + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv); - return DSOUND_QueryInterface((IDirectSound8 *)This, riid, ppv); + + if (!ppv) { + WARN("invalid parameter\n"); + return E_INVALIDARG; + } + *ppv = NULL; + + if (IsEqualIID(riid, &IID_IUnknown)) + *ppv = &This->IUnknown_iface; + else if (IsEqualIID(riid, &IID_IDirectSound) || + (IsEqualIID(riid, &IID_IDirectSound8) && This->has_ds8)) + *ppv = &This->IDirectSound8_iface; + else { + WARN("unknown IID %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; } static ULONG WINAPI IUnknownImpl_AddRef(IUnknown *iface)
1
0
0
0
Michael Stefaniuc : dsound: Handle IDirectSound by the IDirectSound8 implementation.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 9cc62d321c6c6bd05747d94d073cdeb3241c2bcf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9cc62d321c6c6bd05747d94d0…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Jul 19 02:05:37 2012 +0200 dsound: Handle IDirectSound by the IDirectSound8 implementation. --- dlls/dsound/dsound.c | 194 +----------------------------------------- dlls/dsound/dsound_private.h | 1 - dlls/dsound/tests/dsound8.c | 6 +- 3 files changed, 6 insertions(+), 195 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=9cc62d321c6c6bd05747d…
1
0
0
0
Michael Stefaniuc : dsound: Merge IDirectSound8 into the main DirectSound object.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: 6fecd3d6428ceb3bbba09212327f10bfd66e1610 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6fecd3d6428ceb3bbba092123…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Jul 19 02:04:11 2012 +0200 dsound: Merge IDirectSound8 into the main DirectSound object. --- dlls/dsound/dsound.c | 151 +++++++++++++++--------------------------- dlls/dsound/dsound_private.h | 1 - 2 files changed, 54 insertions(+), 98 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=6fecd3d6428ceb3bbba09…
1
0
0
0
Michael Stefaniuc : dsound: Drop a redundant 'IDirectSound8' from the method names.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: db5344e438b69a50e259e561ef3af0ef6f320a8e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=db5344e438b69a50e259e561e…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Jul 19 02:01:55 2012 +0200 dsound: Drop a redundant 'IDirectSound8' from the method names. --- dlls/dsound/dsound.c | 91 +++++++++++++++++++------------------------------ 1 files changed, 35 insertions(+), 56 deletions(-) diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index 9060e76..55af754 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -62,7 +62,6 @@ struct IDirectSound8_IDirectSound8 { }; static HRESULT IDirectSound8_IDirectSound8_Create(LPDIRECTSOUND8 pds, LPDIRECTSOUND8 * ppds); -static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef(LPDIRECTSOUND8 iface); typedef struct IDirectSoundImpl { IUnknown IUnknown_iface; /* Separate refcount, not for COM aggregation */ @@ -183,7 +182,7 @@ static HRESULT DSOUND_QueryInterface( return E_NOINTERFACE; } } - IDirectSound8_IDirectSound8_AddRef(This->pDS8); + IDirectSound8_AddRef(This->pDS8); *ppobj = This->pDS8; return S_OK; } @@ -412,20 +411,17 @@ static HRESULT IDirectSound_IDirectSound_Create( } /******************************************************************************* - * IDirectSound8_IDirectSound8 + * IDirectSound8 Implementation */ -static HRESULT WINAPI IDirectSound8_IDirectSound8_QueryInterface( - LPDIRECTSOUND8 iface, - REFIID riid, - LPVOID * ppobj) +static HRESULT WINAPI IDirectSound8Impl_QueryInterface(IDirectSound8 *iface, REFIID riid, + void **ppobj) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); return DSOUND_QueryInterface(This->pds, riid, ppobj); } -static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef( - LPDIRECTSOUND8 iface) +static ULONG WINAPI IDirectSound8Impl_AddRef(IDirectSound8 *iface) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; ULONG ref = InterlockedIncrement(&(This->ref)); @@ -433,8 +429,7 @@ static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef( return ref; } -static ULONG WINAPI IDirectSound8_IDirectSound8_Release( - LPDIRECTSOUND8 iface) +static ULONG WINAPI IDirectSound8Impl_Release(IDirectSound8 *iface) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; ULONG ref = InterlockedDecrement(&(This->ref)); @@ -448,104 +443,88 @@ static ULONG WINAPI IDirectSound8_IDirectSound8_Release( return ref; } -static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer( - LPDIRECTSOUND8 iface, - LPCDSBUFFERDESC dsbd, - LPLPDIRECTSOUNDBUFFER ppdsb, - LPUNKNOWN lpunk) +static HRESULT WINAPI IDirectSound8Impl_CreateSoundBuffer(IDirectSound8 *iface, + const DSBUFFERDESC *dsbd, IDirectSoundBuffer **ppdsb, IUnknown *lpunk) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p,%p,%p,%p)\n",This,dsbd,ppdsb,lpunk); return DirectSoundDevice_CreateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,dsbd,ppdsb,lpunk,TRUE); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_GetCaps( - LPDIRECTSOUND8 iface, - LPDSCAPS lpDSCaps) +static HRESULT WINAPI IDirectSound8Impl_GetCaps(IDirectSound8 *iface, DSCAPS *lpDSCaps) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p,%p)\n",This,lpDSCaps); return DirectSoundDevice_GetCaps(((IDirectSoundImpl *)This->pds)->device, lpDSCaps); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_DuplicateSoundBuffer( - LPDIRECTSOUND8 iface, - LPDIRECTSOUNDBUFFER psb, - LPLPDIRECTSOUNDBUFFER ppdsb) +static HRESULT WINAPI IDirectSound8Impl_DuplicateSoundBuffer(IDirectSound8 *iface, + IDirectSoundBuffer *psb, IDirectSoundBuffer **ppdsb) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p,%p,%p)\n",This,psb,ppdsb); return DirectSoundDevice_DuplicateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,psb,ppdsb); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_SetCooperativeLevel( - LPDIRECTSOUND8 iface, - HWND hwnd, - DWORD level) +static HRESULT WINAPI IDirectSound8Impl_SetCooperativeLevel(IDirectSound8 *iface, HWND hwnd, + DWORD level) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p,%p,%s)\n",This,hwnd,dumpCooperativeLevel(level)); return DirectSoundDevice_SetCooperativeLevel(((IDirectSoundImpl *)This->pds)->device, hwnd, level); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_Compact( - LPDIRECTSOUND8 iface) +static HRESULT WINAPI IDirectSound8Impl_Compact(IDirectSound8 *iface) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p)\n", This); return DirectSoundDevice_Compact(((IDirectSoundImpl *)This->pds)->device); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_GetSpeakerConfig( - LPDIRECTSOUND8 iface, - LPDWORD lpdwSpeakerConfig) +static HRESULT WINAPI IDirectSound8Impl_GetSpeakerConfig(IDirectSound8 *iface, + DWORD *lpdwSpeakerConfig) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p, %p)\n", This, lpdwSpeakerConfig); return DirectSoundDevice_GetSpeakerConfig(((IDirectSoundImpl *)This->pds)->device,lpdwSpeakerConfig); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_SetSpeakerConfig( - LPDIRECTSOUND8 iface, - DWORD config) +static HRESULT WINAPI IDirectSound8Impl_SetSpeakerConfig(IDirectSound8 *iface, DWORD config) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p,0x%08x)\n",This,config); return DirectSoundDevice_SetSpeakerConfig(((IDirectSoundImpl *)This->pds)->device,config); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_Initialize( - LPDIRECTSOUND8 iface, - LPCGUID lpcGuid) +static HRESULT WINAPI IDirectSound8Impl_Initialize(IDirectSound8 *iface, const GUID *lpcGuid) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p, %s)\n", This, debugstr_guid(lpcGuid)); return DirectSoundDevice_Initialize(&((IDirectSoundImpl *)This->pds)->device,lpcGuid); } -static HRESULT WINAPI IDirectSound8_IDirectSound8_VerifyCertification( - LPDIRECTSOUND8 iface, - LPDWORD pdwCertified) +static HRESULT WINAPI IDirectSound8Impl_VerifyCertification(IDirectSound8 *iface, + DWORD *pdwCertified) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; TRACE("(%p, %p)\n", This, pdwCertified); return DirectSoundDevice_VerifyCertification(((IDirectSoundImpl *)This->pds)->device,pdwCertified); } -static const IDirectSound8Vtbl DirectSound8_DirectSound8_Vtbl = +static const IDirectSound8Vtbl ds8_vtbl = { - IDirectSound8_IDirectSound8_QueryInterface, - IDirectSound8_IDirectSound8_AddRef, - IDirectSound8_IDirectSound8_Release, - IDirectSound8_IDirectSound8_CreateSoundBuffer, - IDirectSound8_IDirectSound8_GetCaps, - IDirectSound8_IDirectSound8_DuplicateSoundBuffer, - IDirectSound8_IDirectSound8_SetCooperativeLevel, - IDirectSound8_IDirectSound8_Compact, - IDirectSound8_IDirectSound8_GetSpeakerConfig, - IDirectSound8_IDirectSound8_SetSpeakerConfig, - IDirectSound8_IDirectSound8_Initialize, - IDirectSound8_IDirectSound8_VerifyCertification + IDirectSound8Impl_QueryInterface, + IDirectSound8Impl_AddRef, + IDirectSound8Impl_Release, + IDirectSound8Impl_CreateSoundBuffer, + IDirectSound8Impl_GetCaps, + IDirectSound8Impl_DuplicateSoundBuffer, + IDirectSound8Impl_SetCooperativeLevel, + IDirectSound8Impl_Compact, + IDirectSound8Impl_GetSpeakerConfig, + IDirectSound8Impl_SetSpeakerConfig, + IDirectSound8Impl_Initialize, + IDirectSound8Impl_VerifyCertification }; static HRESULT IDirectSound8_IDirectSound8_Create( @@ -573,7 +552,7 @@ static HRESULT IDirectSound8_IDirectSound8_Create( return DSERR_OUTOFMEMORY; } - pdsds->lpVtbl = &DirectSound8_DirectSound8_Vtbl; + pdsds->lpVtbl = &ds8_vtbl; pdsds->ref = 0; pdsds->pds = pds;
1
0
0
0
Michael Stefaniuc : dsound: Merge the DirectSound create functions.
by Alexandre Julliard
19 Jul '12
19 Jul '12
Module: wine Branch: master Commit: bf4481d3f0692f44a9bf9dd0b8e9af72a4b3521d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bf4481d3f0692f44a9bf9dd0b…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Jul 19 02:00:27 2012 +0200 dsound: Merge the DirectSound create functions. --- dlls/dsound/dsound.c | 92 +++++++++-------------------------------- dlls/dsound/dsound_main.c | 4 +- dlls/dsound/dsound_private.h | 4 +- dlls/dsound/duplex.c | 2 +- 4 files changed, 25 insertions(+), 77 deletions(-) diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index 6ce01b2..9060e76 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -583,9 +583,12 @@ static HRESULT IDirectSound8_IDirectSound8_Create( return DS_OK; } -static HRESULT IDirectSoundImpl_Create(void **ppv, BOOL has_ds8) +static HRESULT IDirectSoundImpl_Create(REFIID riid, void **ppv, BOOL has_ds8) { IDirectSoundImpl *obj; + HRESULT hr; + + TRACE("(%s, %p)\n", debugstr_guid(riid), ppv); *ppv = NULL; obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); @@ -594,48 +597,28 @@ static HRESULT IDirectSoundImpl_Create(void **ppv, BOOL has_ds8) return DSERR_OUTOFMEMORY; } + setup_dsound_options(); + obj->IUnknown_iface.lpVtbl = &unk_vtbl; - obj->ref = 0; - obj->numIfaces = 0; + obj->ref = 1; + obj->numIfaces = 1; obj->device = NULL; obj->has_ds8 = has_ds8; - *ppv = obj; - return DS_OK; + hr = IUnknown_QueryInterface(&obj->IUnknown_iface, riid, ppv); + IUnknown_Release(&obj->IUnknown_iface); + + return hr; } -HRESULT DSOUND_Create( - REFIID riid, - LPDIRECTSOUND *ppDS) +HRESULT DSOUND_Create(REFIID riid, void **ppv) { - LPDIRECTSOUND8 pDS; - HRESULT hr; - TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS); - - if (!IsEqualIID(riid, &IID_IUnknown) && - !IsEqualIID(riid, &IID_IDirectSound)) { - *ppDS = 0; - return E_NOINTERFACE; - } - - /* Get dsound configuration */ - setup_dsound_options(); - - hr = IDirectSoundImpl_Create((void **)&pDS, FALSE); - if (hr == DS_OK) { - hr = IDirectSound_IDirectSound_Create(pDS, ppDS); - if (*ppDS) - IDirectSound_IDirectSound_AddRef(*ppDS); - else { - WARN("IDirectSound_IDirectSound_Create failed\n"); - IDirectSound8_Release(pDS); - } - } else { - WARN("IDirectSoundImpl_Create failed\n"); - *ppDS = 0; - } + return IDirectSoundImpl_Create(riid, ppv, FALSE); +} - return hr; +HRESULT DSOUND_Create8(REFIID riid, void **ppv) +{ + return IDirectSoundImpl_Create(riid, ppv, TRUE); } /******************************************************************************* @@ -674,7 +657,7 @@ HRESULT WINAPI DirectSoundCreate( return DSERR_INVALIDPARAM; } - hr = DSOUND_Create(&IID_IDirectSound, &pDS); + hr = DSOUND_Create(&IID_IDirectSound, (void **)&pDS); if (hr == DS_OK) { hr = IDirectSound_Initialize(pDS, lpcGUID); if (hr != DS_OK) { @@ -691,41 +674,6 @@ HRESULT WINAPI DirectSoundCreate( return hr; } -HRESULT DSOUND_Create8( - REFIID riid, - LPDIRECTSOUND8 *ppDS) -{ - LPDIRECTSOUND8 pDS; - HRESULT hr; - TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS); - - if (!IsEqualIID(riid, &IID_IUnknown) && - !IsEqualIID(riid, &IID_IDirectSound) && - !IsEqualIID(riid, &IID_IDirectSound8)) { - *ppDS = 0; - return E_NOINTERFACE; - } - - /* Get dsound configuration */ - setup_dsound_options(); - - hr = IDirectSoundImpl_Create((void **)&pDS, TRUE); - if (hr == DS_OK) { - hr = IDirectSound8_IDirectSound8_Create(pDS, ppDS); - if (*ppDS) - IDirectSound8_IDirectSound8_AddRef(*ppDS); - else { - WARN("IDirectSound8_IDirectSound8_Create failed\n"); - IDirectSound8_Release(pDS); - } - } else { - WARN("IDirectSoundImpl_Create failed\n"); - *ppDS = 0; - } - - return hr; -} - /******************************************************************************* * DirectSoundCreate8 (DSOUND.11) * @@ -762,7 +710,7 @@ HRESULT WINAPI DirectSoundCreate8( return DSERR_INVALIDPARAM; } - hr = DSOUND_Create8(&IID_IDirectSound8, &pDS); + hr = DSOUND_Create8(&IID_IDirectSound8, (void **)&pDS); if (hr == DS_OK) { hr = IDirectSound8_Initialize(pDS, lpcGUID); if (hr != DS_OK) { diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c index c0d2b33..e1969a1 100644 --- a/dlls/dsound/dsound_main.c +++ b/dlls/dsound/dsound_main.c @@ -719,8 +719,8 @@ static const IClassFactoryVtbl DSCF_Vtbl = { }; static IClassFactoryImpl DSOUND_CF[] = { - { { &DSCF_Vtbl }, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create }, - { { &DSCF_Vtbl }, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 }, + { { &DSCF_Vtbl }, &CLSID_DirectSound, DSOUND_Create }, + { { &DSCF_Vtbl }, &CLSID_DirectSound8, DSOUND_Create8 }, { { &DSCF_Vtbl }, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate }, { { &DSCF_Vtbl }, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 }, { { &DSCF_Vtbl }, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate }, diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 8d361bc..d822744 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -264,8 +264,8 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks) DEC /* dsound.c */ -HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS) DECLSPEC_HIDDEN; -HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS) DECLSPEC_HIDDEN; +HRESULT DSOUND_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN; +HRESULT DSOUND_Create8(REFIID riid, void **ppv) DECLSPEC_HIDDEN; /* primary.c */ diff --git a/dlls/dsound/duplex.c b/dlls/dsound/duplex.c index e3477ea..ccb0c9b 100644 --- a/dlls/dsound/duplex.c +++ b/dlls/dsound/duplex.c @@ -557,7 +557,7 @@ IDirectSoundFullDuplexImpl_Initialize( return DSERR_ALREADYINITIALIZED; } - hr = DSOUND_Create8(&IID_IDirectSound8, &This->renderer_device); + hr = DSOUND_Create8(&IID_IDirectSound8, (void **)&This->renderer_device); if (SUCCEEDED(hr)) hr = IDirectSound_Initialize(This->renderer_device, pRendererGuid); if (hr != DS_OK) {
1
0
0
0
← Newer
1
...
25
26
27
28
29
30
31
...
72
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Results per page:
10
25
50
100
200