Alex Balut : mshtml: Removed the reference counting of the DLL.

Alexandre Julliard julliard at winehq.org
Tue Dec 9 06:24:13 CST 2008


Module: wine
Branch: master
Commit: fdac425f7fbd7d17ece4dec57bd6986192fb0b97
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fdac425f7fbd7d17ece4dec57bd6986192fb0b97

Author: Alex Balut <alexandru.balut at gmail.com>
Date:   Fri Dec  5 20:04:03 2008 +0100

mshtml: Removed the reference counting of the DLL.

---

 dlls/mshtml/htmldoc.c        |    4 ----
 dlls/mshtml/main.c           |   17 +++++------------
 dlls/mshtml/mshtml_private.h |    4 ----
 dlls/mshtml/protocol.c       |   28 +++++-----------------------
 4 files changed, 10 insertions(+), 43 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index dc0d87a..0f4bcf4 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -214,8 +214,6 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
             NSContainer_Release(This->nscontainer);
 
         heap_free(This);
-
-        UNLOCK_MODULE();
     }
 
     return ref;
@@ -1810,8 +1808,6 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
     if(FAILED(hres))
         return hres;
 
-    LOCK_MODULE();
-
     doc->nscontainer = NSContainer_Create(doc, NULL);
     update_nsdocument(doc);
 
diff --git a/dlls/mshtml/main.c b/dlls/mshtml/main.c
index 8b441f0..b1c8756 100644
--- a/dlls/mshtml/main.c
+++ b/dlls/mshtml/main.c
@@ -44,7 +44,6 @@
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 HINSTANCE hInst;
-LONG module_ref = 0;
 DWORD mshtml_tls = 0;
 
 static HINSTANCE shdoclc = NULL;
@@ -141,7 +140,6 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
 
     if(!ref) {
         heap_free(This);
-        UNLOCK_MODULE();
     }
 
     return ref;
@@ -158,11 +156,7 @@ static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
 {
     TRACE("(%p)->(%x)\n", iface, dolock);
 
-    if(dolock)
-        LOCK_MODULE();
-    else
-        UNLOCK_MODULE();
-
+    /* We never unload the DLL. See DllCanUnloadNow(). */
     return S_OK;
 }
 
@@ -184,9 +178,7 @@ static HRESULT ClassFactory_Create(REFIID riid, void **ppv, CreateInstanceFunc f
     ret->fnCreateInstance = fnCreateInstance;
 
     hres = IClassFactory_QueryInterface((IClassFactory*)ret, riid, ppv);
-    if(SUCCEEDED(hres)) {
-        LOCK_MODULE();
-    }else {
+    if(FAILED(hres)) {
         heap_free(ret);
         *ppv = NULL;
     }
@@ -230,8 +222,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
  */
 HRESULT WINAPI DllCanUnloadNow(void)
 {
-    TRACE("() ref=%d\n", module_ref);
-    return module_ref ? S_FALSE : S_OK;
+    TRACE("()\n");
+    /* The cost of keeping this DLL in memory is small. */
+    return S_FALSE;
 }
 
 /***********************************************************************
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index a6e8783..60e250d 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -668,10 +668,6 @@ DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,
 
 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
 
-extern LONG module_ref;
-#define LOCK_MODULE()   InterlockedIncrement(&module_ref)
-#define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
-
 /* memory allocation functions */
 
 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index 4cdac9f..8483600 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -77,17 +77,13 @@ static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
 
 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
 {
-    ProtocolFactory *This = PROTOCOLINFO_THIS(iface);
-    TRACE("(%p)\n", This);
-    LOCK_MODULE();
+    TRACE("(%p)\n", iface);
     return 2;
 }
 
 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
 {
-    ProtocolFactory *This = PROTOCOLINFO_THIS(iface);
-    TRACE("(%p)\n", This);
-    UNLOCK_MODULE();
+    TRACE("(%p)\n", iface);
     return 1;
 }
 
@@ -133,15 +129,7 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
 
 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
 {
-    ProtocolFactory *This = CLASSFACTORY_THIS(iface);
-
-    TRACE("(%p)->(%x)\n", This, dolock);
-
-    if(dolock)
-        LOCK_MODULE();
-    else
-        UNLOCK_MODULE();
-
+    TRACE("(%p)->(%x)\n", iface, dolock);
     return S_OK;
 }
 
@@ -215,7 +203,6 @@ static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface)
     if(!ref) {
         heap_free(This->data);
         heap_free(This);
-        UNLOCK_MODULE();
     }
 
     return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref;
@@ -408,9 +395,7 @@ static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface,
         hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv);
     }
 
-    if(SUCCEEDED(hres))
-        LOCK_MODULE();
-    else
+    if(FAILED(hres))
         heap_free(ret);
 
     return hres;
@@ -583,7 +568,6 @@ static ULONG WINAPI ResProtocol_Release(IInternetProtocol *iface)
     if(!ref) {
         heap_free(This->data);
         heap_free(This);
-        UNLOCK_MODULE();
     }
 
     return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref;
@@ -833,9 +817,7 @@ static HRESULT WINAPI ResProtocolFactory_CreateInstance(IClassFactory *iface, IU
         hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv);
     }
 
-    if(SUCCEEDED(hres))
-        LOCK_MODULE();
-    else
+    if(FAILED(hres))
         heap_free(ret);
 
     return hres;




More information about the wine-cvs mailing list