ieframe: Store ShellBrowser in DocHost instead of creating it on every QueryService call.
This commit is contained in:
parent
dcf1a81d8c
commit
c05558a245
|
@ -672,18 +672,17 @@ static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, RE
|
|||
}
|
||||
|
||||
if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
|
||||
IShellBrowser *sb;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(IID_IShellBrowser %s %p)\n", This, debugstr_guid(riid), ppv);
|
||||
|
||||
hres = ShellBrowser_Create(&sb);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
if(!This->browser_service) {
|
||||
HRESULT hres;
|
||||
|
||||
hres = IShellBrowser_QueryInterface(sb, riid, ppv);
|
||||
IShellBrowser_Release(sb);
|
||||
return hres;
|
||||
hres = create_browser_service(This, &This->browser_service);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
return IShellBrowser_QueryInterface(&This->browser_service->IShellBrowser_iface, riid, ppv);
|
||||
}
|
||||
|
||||
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
|
||||
|
@ -710,6 +709,8 @@ void DocHost_ClientSite_Init(DocHost *This)
|
|||
|
||||
void DocHost_ClientSite_Release(DocHost *This)
|
||||
{
|
||||
if(This->browser_service)
|
||||
detach_browser_service(This->browser_service);
|
||||
if(This->view)
|
||||
IOleDocumentView_Release(This->view);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include "exdisp.h"
|
||||
#include "hlink.h"
|
||||
#include "htiframe.h"
|
||||
#include "shdeprecated.h"
|
||||
#include "docobjectservice.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
|
@ -71,6 +73,16 @@ typedef struct _task_header_t {
|
|||
task_destr_t destr;
|
||||
} task_header_t;
|
||||
|
||||
typedef struct {
|
||||
IShellBrowser IShellBrowser_iface;
|
||||
IBrowserService IBrowserService_iface;
|
||||
IDocObjectService IDocObjectService_iface;
|
||||
|
||||
LONG ref;
|
||||
|
||||
DocHost *doc_host;
|
||||
} ShellBrowser;
|
||||
|
||||
typedef struct _IDocHostContainerVtbl
|
||||
{
|
||||
ULONG (*addref)(DocHost*);
|
||||
|
@ -123,6 +135,8 @@ struct DocHost {
|
|||
DWORD prop_notif_cookie;
|
||||
BOOL is_prop_notif;
|
||||
|
||||
ShellBrowser *browser_service;
|
||||
|
||||
ConnectionPointContainer cps;
|
||||
};
|
||||
|
||||
|
@ -213,7 +227,8 @@ void release_dochost_client(DocHost*) DECLSPEC_HIDDEN;
|
|||
void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN;
|
||||
BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT ShellBrowser_Create(IShellBrowser**) DECLSPEC_HIDDEN;
|
||||
HRESULT create_browser_service(DocHost*,ShellBrowser**) DECLSPEC_HIDDEN;
|
||||
void detach_browser_service(ShellBrowser*) DECLSPEC_HIDDEN;
|
||||
|
||||
void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
|
||||
void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -18,23 +18,14 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "ieframe.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "shdeprecated.h"
|
||||
#include "docobjectservice.h"
|
||||
#include "ieframe.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
|
||||
|
||||
typedef struct {
|
||||
IShellBrowser IShellBrowser_iface;
|
||||
IBrowserService IBrowserService_iface;
|
||||
IDocObjectService IDocObjectService_iface;
|
||||
|
||||
LONG ref;
|
||||
} ShellBrowser;
|
||||
|
||||
static inline ShellBrowser *impl_from_IShellBrowser(IShellBrowser *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, ShellBrowser, IShellBrowser_iface);
|
||||
|
@ -77,16 +68,18 @@ static ULONG WINAPI ShellBrowser_AddRef(
|
|||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ShellBrowser_Release(
|
||||
IShellBrowser* iface)
|
||||
static ULONG WINAPI ShellBrowser_Release(IShellBrowser* iface)
|
||||
{
|
||||
ShellBrowser *This = impl_from_IShellBrowser(iface);
|
||||
LONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref)
|
||||
if(!ref) {
|
||||
assert(!This->doc_host);
|
||||
heap_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -759,7 +752,7 @@ static const IDocObjectServiceVtbl DocObjectServiceVtbl = {
|
|||
DocObjectService_IsErrorUrl
|
||||
};
|
||||
|
||||
HRESULT ShellBrowser_Create(IShellBrowser **ppv)
|
||||
HRESULT create_browser_service(DocHost *doc_host, ShellBrowser **ret)
|
||||
{
|
||||
ShellBrowser *sb;
|
||||
|
||||
|
@ -772,7 +765,14 @@ HRESULT ShellBrowser_Create(IShellBrowser **ppv)
|
|||
sb->IDocObjectService_iface.lpVtbl = &DocObjectServiceVtbl;
|
||||
|
||||
sb->ref = 1;
|
||||
sb->doc_host = doc_host;
|
||||
|
||||
*ppv = &sb->IShellBrowser_iface;
|
||||
*ret = sb;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void detach_browser_service(ShellBrowser *sb)
|
||||
{
|
||||
sb->doc_host = NULL;
|
||||
IShellBrowser_Release(&sb->IShellBrowser_iface);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "exdispid.h"
|
||||
#include "mshtml.h"
|
||||
#include "shdeprecated.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue